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