@@ -2452,19 +2452,12 @@ namespace {
2452
2452
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2453
2453
bindPatternVarsOneWay);
2454
2454
2455
- if (!underlyingType)
2456
- return Type ();
2457
-
2458
2455
return setType (ParenType::get (CS.getASTContext (), underlyingType));
2459
2456
}
2460
2457
case PatternKind::Binding: {
2461
2458
auto *subPattern = cast<BindingPattern>(pattern)->getSubPattern ();
2462
2459
auto type = getTypeForPattern (subPattern, locator,
2463
2460
bindPatternVarsOneWay);
2464
-
2465
- if (!type)
2466
- return Type ();
2467
-
2468
2461
// Var doesn't affect the type.
2469
2462
return setType (type);
2470
2463
}
@@ -2646,9 +2639,6 @@ namespace {
2646
2639
2647
2640
Type type = TypeChecker::typeCheckPattern (contextualPattern);
2648
2641
2649
- if (!type)
2650
- return Type ();
2651
-
2652
2642
// Look through reference storage types.
2653
2643
type = type->getReferenceStorageReferent ();
2654
2644
@@ -2665,9 +2655,6 @@ namespace {
2665
2655
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2666
2656
bindPatternVarsOneWay);
2667
2657
2668
- if (!subPatternType)
2669
- return Type ();
2670
-
2671
2658
// NOTE: The order here is important! Pattern matching equality is
2672
2659
// not symmetric (we need to fix that either by using a different
2673
2660
// constraint, or actually making it symmetric).
@@ -2697,9 +2684,6 @@ namespace {
2697
2684
locator.withPathElement (LocatorPathElt::PatternMatch (eltPattern)),
2698
2685
bindPatternVarsOneWay);
2699
2686
2700
- if (!eltTy)
2701
- return Type ();
2702
-
2703
2687
tupleTypeElts.push_back (TupleTypeElt (eltTy, tupleElt.getLabel ()));
2704
2688
}
2705
2689
@@ -2714,9 +2698,6 @@ namespace {
2714
2698
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2715
2699
bindPatternVarsOneWay);
2716
2700
2717
- if (!subPatternType)
2718
- return Type ();
2719
-
2720
2701
return setType (OptionalType::get (subPatternType));
2721
2702
}
2722
2703
@@ -2726,7 +2707,6 @@ namespace {
2726
2707
const Type castType = resolveTypeReferenceInExpression (
2727
2708
isPattern->getCastTypeRepr (), TypeResolverContext::InExpression,
2728
2709
locator.withPathElement (LocatorPathElt::PatternMatch (pattern)));
2729
- if (!castType) return Type ();
2730
2710
2731
2711
// Allow `is` pattern to infer type from context which is then going
2732
2712
// to be propaged down to its sub-pattern via conversion. This enables
@@ -2814,9 +2794,6 @@ namespace {
2814
2794
TypeResolverContext::InExpression, patternMatchLoc);
2815
2795
}();
2816
2796
2817
- if (!parentType)
2818
- return Type ();
2819
-
2820
2797
// Perform member lookup into the parent's metatype.
2821
2798
Type parentMetaType = MetatypeType::get (parentType);
2822
2799
CS.addValueMemberConstraint (
@@ -2851,9 +2828,6 @@ namespace {
2851
2828
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2852
2829
bindPatternVarsOneWay);
2853
2830
2854
- if (!subPatternType)
2855
- return Type ();
2856
-
2857
2831
SmallVector<AnyFunctionType::Param, 4 > params;
2858
2832
decomposeTuple (subPatternType, params);
2859
2833
0 commit comments