Guard feature behind experimental flag.

This commit is contained in:
Amritpan Kaur
2025-01-20 10:44:34 -08:00
parent 15c219cd70
commit 98cd675eb9
14 changed files with 98 additions and 20 deletions

View File

@@ -10826,6 +10826,9 @@ static ConstraintFix *validateInitializerRef(ConstraintSystem &cs,
// which means MetatypeType has to be added after finding a type variable.
if (baseLocator->isLastElement<LocatorPathElt::MemberRefBase>())
baseType = MetatypeType::get(baseType);
} else if (auto *keyPathExpr = getAsExpr<KeyPathExpr>(anchor)) {
// Key path can't refer to initializers e.g. `\Type.init`
return AllowInvalidRefInKeyPath::forRef(cs, baseType, init, locator);
}
if (!baseType)