@@ -2753,6 +2753,15 @@ namespace {
2753
2753
}
2754
2754
2755
2755
Expr *visitUnresolvedMemberExpr (UnresolvedMemberExpr *expr) {
2756
+ // If constraint solving resolved this to an UnresolvedType, then we're in
2757
+ // an ambiguity tolerant mode used for diagnostic generation. Just leave
2758
+ // this as an unresolved member reference.
2759
+ Type resultTy = simplifyType (cs.getType (expr));
2760
+ if (resultTy->getRValueType ()->is <UnresolvedType>()) {
2761
+ cs.setType (expr, resultTy);
2762
+ return expr;
2763
+ }
2764
+
2756
2765
auto &ctx = cs.getASTContext ();
2757
2766
// Find the selected member and base type.
2758
2767
auto memberLocator = cs.getConstraintLocator (
@@ -2762,6 +2771,7 @@ namespace {
2762
2771
// Unresolved member lookup always happens in a metatype so dig out the
2763
2772
// instance type.
2764
2773
auto baseTy = selected.choice .getBaseType ()->getMetatypeInstanceType ();
2774
+ baseTy = simplifyType (baseTy);
2765
2775
2766
2776
// The base expression is simply the metatype of the base type.
2767
2777
// FIXME: This location info is bogus.
@@ -2805,8 +2815,7 @@ namespace {
2805
2815
diagnoseAmbiguousNominalMember (baseTy, result);
2806
2816
}
2807
2817
2808
- return coerceToType (result, simplifyType (cs.getType (expr)),
2809
- cs.getConstraintLocator (expr));
2818
+ return coerceToType (result, resultTy, cs.getConstraintLocator (expr));
2810
2819
}
2811
2820
2812
2821
// / Diagnose if the base type is optional, we're referring to a nominal
0 commit comments