@@ -2420,19 +2420,12 @@ namespace {
2420
2420
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2421
2421
bindPatternVarsOneWay);
2422
2422
2423
- if (!underlyingType)
2424
- return Type ();
2425
-
2426
2423
return setType (ParenType::get (CS.getASTContext (), underlyingType));
2427
2424
}
2428
2425
case PatternKind::Binding: {
2429
2426
auto *subPattern = cast<BindingPattern>(pattern)->getSubPattern ();
2430
2427
auto type = getTypeForPattern (subPattern, locator,
2431
2428
bindPatternVarsOneWay);
2432
-
2433
- if (!type)
2434
- return Type ();
2435
-
2436
2429
// Var doesn't affect the type.
2437
2430
return setType (type);
2438
2431
}
@@ -2608,9 +2601,6 @@ namespace {
2608
2601
2609
2602
Type type = TypeChecker::typeCheckPattern (contextualPattern);
2610
2603
2611
- if (!type)
2612
- return Type ();
2613
-
2614
2604
// Look through reference storage types.
2615
2605
type = type->getReferenceStorageReferent ();
2616
2606
@@ -2627,9 +2617,6 @@ namespace {
2627
2617
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2628
2618
bindPatternVarsOneWay);
2629
2619
2630
- if (!subPatternType)
2631
- return Type ();
2632
-
2633
2620
// NOTE: The order here is important! Pattern matching equality is
2634
2621
// not symmetric (we need to fix that either by using a different
2635
2622
// constraint, or actually making it symmetric).
@@ -2659,9 +2646,6 @@ namespace {
2659
2646
locator.withPathElement (LocatorPathElt::PatternMatch (eltPattern)),
2660
2647
bindPatternVarsOneWay);
2661
2648
2662
- if (!eltTy)
2663
- return Type ();
2664
-
2665
2649
tupleTypeElts.push_back (TupleTypeElt (eltTy, tupleElt.getLabel ()));
2666
2650
}
2667
2651
@@ -2676,9 +2660,6 @@ namespace {
2676
2660
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2677
2661
bindPatternVarsOneWay);
2678
2662
2679
- if (!subPatternType)
2680
- return Type ();
2681
-
2682
2663
return setType (OptionalType::get (subPatternType));
2683
2664
}
2684
2665
@@ -2688,7 +2669,6 @@ namespace {
2688
2669
const Type castType = resolveTypeReferenceInExpression (
2689
2670
isPattern->getCastTypeRepr (), TypeResolverContext::InExpression,
2690
2671
locator.withPathElement (LocatorPathElt::PatternMatch (pattern)));
2691
- if (!castType) return Type ();
2692
2672
2693
2673
// Allow `is` pattern to infer type from context which is then going
2694
2674
// to be propaged down to its sub-pattern via conversion. This enables
@@ -2775,9 +2755,6 @@ namespace {
2775
2755
TypeResolverContext::InExpression, patternMatchLoc);
2776
2756
}();
2777
2757
2778
- if (!parentType)
2779
- return Type ();
2780
-
2781
2758
// Perform member lookup into the parent's metatype.
2782
2759
Type parentMetaType = MetatypeType::get (parentType);
2783
2760
CS.addValueMemberConstraint (
@@ -2812,9 +2789,6 @@ namespace {
2812
2789
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2813
2790
bindPatternVarsOneWay);
2814
2791
2815
- if (!subPatternType)
2816
- return Type ();
2817
-
2818
2792
SmallVector<AnyFunctionType::Param, 4 > params;
2819
2793
decomposeTuple (subPatternType, params);
2820
2794
0 commit comments