mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CS] Move getUnopenedTypeOfReference out of TypeChecker
For some reason, the changed caller in CS wasn't actually going to use any of the types in the constraint system from the entrypoint it was calling. Switch over to using the constraint-system-based entrypoint so we can pick up expression types consistently. Then, move the TypeChecker entrypoint onto ConstraintSystem to reduce the duplication here. The remaining callers of buildCheckedRefExpr should be migrated.
This commit is contained in:
@@ -925,7 +925,7 @@ Type ConstraintSystem::getUnopenedTypeOfReference(VarDecl *value, Type baseType,
|
||||
DeclContext *UseDC,
|
||||
const DeclRefExpr *base,
|
||||
bool wantInterfaceType) {
|
||||
return TypeChecker::getUnopenedTypeOfReference(
|
||||
return ConstraintSystem::getUnopenedTypeOfReference(
|
||||
value, baseType, UseDC,
|
||||
[&](VarDecl *var) -> Type {
|
||||
if (Type type = getTypeIfAvailable(var))
|
||||
@@ -940,7 +940,7 @@ Type ConstraintSystem::getUnopenedTypeOfReference(VarDecl *value, Type baseType,
|
||||
base, wantInterfaceType);
|
||||
}
|
||||
|
||||
Type TypeChecker::getUnopenedTypeOfReference(
|
||||
Type ConstraintSystem::getUnopenedTypeOfReference(
|
||||
VarDecl *value, Type baseType, DeclContext *UseDC,
|
||||
llvm::function_ref<Type(VarDecl *)> getType, const DeclRefExpr *base,
|
||||
bool wantInterfaceType) {
|
||||
@@ -1405,9 +1405,9 @@ ConstraintSystem::getTypeOfMemberReference(
|
||||
->castTo<AnyFunctionType>()->getParams();
|
||||
refType = FunctionType::get(indices, elementTy);
|
||||
} else {
|
||||
refType = TypeChecker::getUnopenedTypeOfReference(
|
||||
cast<VarDecl>(value), baseTy, useDC, base,
|
||||
/*wantInterfaceType=*/true);
|
||||
refType =
|
||||
getUnopenedTypeOfReference(cast<VarDecl>(value), baseTy, useDC, base,
|
||||
/*wantInterfaceType=*/true);
|
||||
}
|
||||
|
||||
auto selfTy = outerDC->getSelfInterfaceType();
|
||||
|
||||
Reference in New Issue
Block a user