@@ -2411,19 +2411,12 @@ namespace {
2411
2411
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2412
2412
bindPatternVarsOneWay);
2413
2413
2414
- if (!underlyingType)
2415
- return Type ();
2416
-
2417
2414
return setType (ParenType::get (CS.getASTContext (), underlyingType));
2418
2415
}
2419
2416
case PatternKind::Binding: {
2420
2417
auto *subPattern = cast<BindingPattern>(pattern)->getSubPattern ();
2421
2418
auto type = getTypeForPattern (subPattern, locator,
2422
2419
bindPatternVarsOneWay);
2423
-
2424
- if (!type)
2425
- return Type ();
2426
-
2427
2420
// Var doesn't affect the type.
2428
2421
return setType (type);
2429
2422
}
@@ -2599,9 +2592,6 @@ namespace {
2599
2592
2600
2593
Type type = TypeChecker::typeCheckPattern (contextualPattern);
2601
2594
2602
- if (!type)
2603
- return Type ();
2604
-
2605
2595
// Look through reference storage types.
2606
2596
type = type->getReferenceStorageReferent ();
2607
2597
@@ -2618,9 +2608,6 @@ namespace {
2618
2608
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2619
2609
bindPatternVarsOneWay);
2620
2610
2621
- if (!subPatternType)
2622
- return Type ();
2623
-
2624
2611
// NOTE: The order here is important! Pattern matching equality is
2625
2612
// not symmetric (we need to fix that either by using a different
2626
2613
// constraint, or actually making it symmetric).
@@ -2650,9 +2637,6 @@ namespace {
2650
2637
locator.withPathElement (LocatorPathElt::PatternMatch (eltPattern)),
2651
2638
bindPatternVarsOneWay);
2652
2639
2653
- if (!eltTy)
2654
- return Type ();
2655
-
2656
2640
tupleTypeElts.push_back (TupleTypeElt (eltTy, tupleElt.getLabel ()));
2657
2641
}
2658
2642
@@ -2667,9 +2651,6 @@ namespace {
2667
2651
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2668
2652
bindPatternVarsOneWay);
2669
2653
2670
- if (!subPatternType)
2671
- return Type ();
2672
-
2673
2654
return setType (OptionalType::get (subPatternType));
2674
2655
}
2675
2656
@@ -2679,7 +2660,6 @@ namespace {
2679
2660
const Type castType = resolveTypeReferenceInExpression (
2680
2661
isPattern->getCastTypeRepr (), TypeResolverContext::InExpression,
2681
2662
locator.withPathElement (LocatorPathElt::PatternMatch (pattern)));
2682
- if (!castType) return Type ();
2683
2663
2684
2664
// Allow `is` pattern to infer type from context which is then going
2685
2665
// to be propaged down to its sub-pattern via conversion. This enables
@@ -2766,9 +2746,6 @@ namespace {
2766
2746
TypeResolverContext::InExpression, patternMatchLoc);
2767
2747
}();
2768
2748
2769
- if (!parentType)
2770
- return Type ();
2771
-
2772
2749
// Perform member lookup into the parent's metatype.
2773
2750
Type parentMetaType = MetatypeType::get (parentType);
2774
2751
CS.addValueMemberConstraint (
@@ -2803,9 +2780,6 @@ namespace {
2803
2780
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2804
2781
bindPatternVarsOneWay);
2805
2782
2806
- if (!subPatternType)
2807
- return Type ();
2808
-
2809
2783
SmallVector<AnyFunctionType::Param, 4 > params;
2810
2784
decomposeTuple (subPatternType, params);
2811
2785
0 commit comments