@@ -2472,19 +2472,12 @@ namespace {
2472
2472
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2473
2473
bindPatternVarsOneWay);
2474
2474
2475
- if (!underlyingType)
2476
- return Type ();
2477
-
2478
2475
return setType (ParenType::get (CS.getASTContext (), underlyingType));
2479
2476
}
2480
2477
case PatternKind::Binding: {
2481
2478
auto *subPattern = cast<BindingPattern>(pattern)->getSubPattern ();
2482
2479
auto type = getTypeForPattern (subPattern, locator,
2483
2480
bindPatternVarsOneWay);
2484
-
2485
- if (!type)
2486
- return Type ();
2487
-
2488
2481
// Var doesn't affect the type.
2489
2482
return setType (type);
2490
2483
}
@@ -2666,9 +2659,6 @@ namespace {
2666
2659
2667
2660
Type type = TypeChecker::typeCheckPattern (contextualPattern);
2668
2661
2669
- if (!type)
2670
- return Type ();
2671
-
2672
2662
// Look through reference storage types.
2673
2663
type = type->getReferenceStorageReferent ();
2674
2664
@@ -2685,9 +2675,6 @@ namespace {
2685
2675
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2686
2676
bindPatternVarsOneWay);
2687
2677
2688
- if (!subPatternType)
2689
- return Type ();
2690
-
2691
2678
// NOTE: The order here is important! Pattern matching equality is
2692
2679
// not symmetric (we need to fix that either by using a different
2693
2680
// constraint, or actually making it symmetric).
@@ -2717,9 +2704,6 @@ namespace {
2717
2704
locator.withPathElement (LocatorPathElt::PatternMatch (eltPattern)),
2718
2705
bindPatternVarsOneWay);
2719
2706
2720
- if (!eltTy)
2721
- return Type ();
2722
-
2723
2707
tupleTypeElts.push_back (TupleTypeElt (eltTy, tupleElt.getLabel ()));
2724
2708
}
2725
2709
@@ -2734,9 +2718,6 @@ namespace {
2734
2718
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2735
2719
bindPatternVarsOneWay);
2736
2720
2737
- if (!subPatternType)
2738
- return Type ();
2739
-
2740
2721
return setType (OptionalType::get (subPatternType));
2741
2722
}
2742
2723
@@ -2746,7 +2727,6 @@ namespace {
2746
2727
const Type castType = resolveTypeReferenceInExpression (
2747
2728
isPattern->getCastTypeRepr (), TypeResolverContext::InExpression,
2748
2729
locator.withPathElement (LocatorPathElt::PatternMatch (pattern)));
2749
- if (!castType) return Type ();
2750
2730
2751
2731
// Allow `is` pattern to infer type from context which is then going
2752
2732
// to be propaged down to its sub-pattern via conversion. This enables
@@ -2834,9 +2814,6 @@ namespace {
2834
2814
TypeResolverContext::InExpression, patternMatchLoc);
2835
2815
}();
2836
2816
2837
- if (!parentType)
2838
- return Type ();
2839
-
2840
2817
// Perform member lookup into the parent's metatype.
2841
2818
Type parentMetaType = MetatypeType::get (parentType);
2842
2819
CS.addValueMemberConstraint (
@@ -2871,9 +2848,6 @@ namespace {
2871
2848
locator.withPathElement (LocatorPathElt::PatternMatch (subPattern)),
2872
2849
bindPatternVarsOneWay);
2873
2850
2874
- if (!subPatternType)
2875
- return Type ();
2876
-
2877
2851
SmallVector<AnyFunctionType::Param, 4 > params;
2878
2852
decomposeTuple (subPatternType, params);
2879
2853
0 commit comments