Move resolving param type to CSApply

This commit is contained in:
Alejandro Alonso
2025-04-14 11:03:45 -07:00
parent ae355007fc
commit 79a51dfcc1
3 changed files with 13 additions and 10 deletions

View File

@@ -3247,6 +3247,18 @@ namespace {
auto toType = simplifyType(cs.getType(expr));
ASSERT(toType->isEqual(expr->getParamDecl()->getValueType()));
cs.setType(expr, toType);
auto declRefRepr = cast<DeclRefTypeRepr>(expr->getRepr());
auto resolvedTy =
TypeResolution::resolveContextualType(declRefRepr, cs.DC,
TypeResolverContext::InExpression,
nullptr, nullptr, nullptr);
if (!resolvedTy || resolvedTy->hasError())
return nullptr;
expr->setParamType(resolvedTy);
return expr;
}

View File

@@ -1723,15 +1723,6 @@ namespace {
}
Type visitTypeValueExpr(TypeValueExpr *E) {
auto declRefRepr = cast<DeclRefTypeRepr>(E->getRepr());
auto resolvedTy = resolveTypeReferenceInExpression(declRefRepr,
TypeResolverContext::InExpression,
CS.getConstraintLocator(E));
if (!resolvedTy || resolvedTy->hasError())
return Type();
E->setParamType(resolvedTy);
return E->getParamDecl()->getValueType();
}