@@ -1061,7 +1061,6 @@ namespace {
10611061 AccessSemantics semantics) {
10621062 auto choice = overload.choice ;
10631063 auto openedType = overload.openedType ;
1064- auto openedFullType = overload.openedFullType ;
10651064
10661065 ValueDecl *member = choice.getDecl ();
10671066
@@ -1097,13 +1096,15 @@ namespace {
10971096 return result;
10981097 }
10991098
1099+ auto refTy = simplifyType (overload.openedFullType );
1100+
11001101 // If we're referring to the member of a module, it's just a simple
11011102 // reference.
11021103 if (baseTy->is <ModuleType>()) {
11031104 assert (semantics == AccessSemantics::Ordinary &&
11041105 " Direct property access doesn't make sense for this" );
11051106 auto ref = new (context) DeclRefExpr (memberRef, memberLoc, Implicit);
1106- cs.setType (ref, simplifyType (openedFullType) );
1107+ cs.setType (ref, refTy );
11071108 ref->setFunctionRefKind (choice.getFunctionRefKind ());
11081109 auto *DSBI = cs.cacheType (new (context) DotSyntaxBaseIgnoredExpr (
11091110 base, dotLoc, ref, cs.getType (ref)));
@@ -1114,8 +1115,6 @@ namespace {
11141115 (!baseIsInstance && member->isInstanceMember ());
11151116 bool isPartialApplication = shouldBuildCurryThunk (choice, baseIsInstance);
11161117
1117- auto refTy = simplifyType (openedFullType);
1118-
11191118 // The formal type of the 'self' value for the member's declaration.
11201119 Type containerTy = getBaseType (refTy->castTo <FunctionType>());
11211120
@@ -1278,8 +1277,8 @@ namespace {
12781277 = new (context) MemberRefExpr (base, dotLoc, memberRef,
12791278 memberLoc, Implicit, semantics);
12801279 memberRefExpr->setIsSuper (isSuper);
1280+ cs.setType (memberRefExpr, refTy->castTo <FunctionType>()->getResult ());
12811281
1282- cs.setType (memberRefExpr, simplifyType (openedType));
12831282 Expr *result = memberRefExpr;
12841283 closeExistential (result, locator);
12851284
0 commit comments