mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[CSClosure] Declarations prefixed with $ can act as inferrable placeholders
If the type for such declaration could be completely inferred it would be used during solution application. This is used to infer types for result builder components.
This commit is contained in:
@@ -894,6 +894,18 @@ Type ConstraintSystem::replaceInferableTypesWithTypeVars(
|
||||
TVO_CanBindToNoEscape | TVO_PrefersSubtypeBinding |
|
||||
TVO_CanBindToHole);
|
||||
}
|
||||
|
||||
if (auto *var = placeholderTy->getOriginator().dyn_cast<VarDecl *>()) {
|
||||
if (var->getName().hasDollarPrefix()) {
|
||||
auto *repr =
|
||||
new (type->getASTContext()) PlaceholderTypeRepr(var->getLoc());
|
||||
return createTypeVariable(
|
||||
getConstraintLocator(locator,
|
||||
LocatorPathElt::PlaceholderType(repr)),
|
||||
TVO_CanBindToNoEscape | TVO_PrefersSubtypeBinding |
|
||||
TVO_CanBindToHole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
|
||||
Reference in New Issue
Block a user