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