@@ -1274,42 +1274,43 @@ bool AllowInvalidRefInKeyPath::isEqual(const ConstraintFix *other) const {
12741274}
12751275
12761276AllowInvalidRefInKeyPath *
1277- AllowInvalidRefInKeyPath::forRef (ConstraintSystem &cs, ValueDecl *member,
1277+ AllowInvalidRefInKeyPath::forRef (ConstraintSystem &cs, Type baseType,
1278+ ValueDecl *member,
12781279 ConstraintLocator *locator) {
12791280 // Referencing (instance or static) methods in key path is
12801281 // not currently allowed.
12811282 if (isa<FuncDecl>(member))
1282- return AllowInvalidRefInKeyPath::create (cs, RefKind::Method, member ,
1283- locator);
1283+ return AllowInvalidRefInKeyPath::create (cs, baseType, RefKind::Method,
1284+ member, locator);
12841285
12851286 // Referencing enum cases in key path is not currently allowed.
12861287 if (isa<EnumElementDecl>(member)) {
1287- return AllowInvalidRefInKeyPath::create (cs, RefKind::EnumCase, member ,
1288- locator);
1288+ return AllowInvalidRefInKeyPath::create (cs, baseType, RefKind::EnumCase,
1289+ member, locator);
12891290 }
12901291
12911292 // Referencing initializers in key path is not currently allowed.
12921293 if (isa<ConstructorDecl>(member))
1293- return AllowInvalidRefInKeyPath::create (cs, RefKind::Initializer,
1294+ return AllowInvalidRefInKeyPath::create (cs, baseType, RefKind::Initializer,
12941295 member, locator);
12951296
12961297 if (auto *storage = dyn_cast<AbstractStorageDecl>(member)) {
12971298 // Referencing members with mutating getters in key path is not
12981299 // currently allowed.
12991300 if (storage->isGetterMutating ())
1300- return AllowInvalidRefInKeyPath::create (cs, RefKind::MutatingGetter,
1301- member, locator);
1301+ return AllowInvalidRefInKeyPath::create (
1302+ cs, baseType, RefKind::MutatingGetter, member, locator);
13021303 }
13031304
13041305 return nullptr ;
13051306}
13061307
13071308AllowInvalidRefInKeyPath *
1308- AllowInvalidRefInKeyPath::create (ConstraintSystem &cs, RefKind kind ,
1309- ValueDecl *member,
1309+ AllowInvalidRefInKeyPath::create (ConstraintSystem &cs, Type baseType ,
1310+ RefKind kind, ValueDecl *member,
13101311 ConstraintLocator *locator) {
13111312 return new (cs.getAllocator ())
1312- AllowInvalidRefInKeyPath (cs, kind, member, locator);
1313+ AllowInvalidRefInKeyPath (cs, baseType, kind, member, locator);
13131314}
13141315
13151316bool RemoveAddressOf::diagnose (const Solution &solution, bool asNote) const {
0 commit comments