mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Move resolving param type to CSApply
This commit is contained in:
@@ -3247,6 +3247,18 @@ namespace {
|
|||||||
auto toType = simplifyType(cs.getType(expr));
|
auto toType = simplifyType(cs.getType(expr));
|
||||||
ASSERT(toType->isEqual(expr->getParamDecl()->getValueType()));
|
ASSERT(toType->isEqual(expr->getParamDecl()->getValueType()));
|
||||||
cs.setType(expr, toType);
|
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;
|
return expr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1723,15 +1723,6 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Type visitTypeValueExpr(TypeValueExpr *E) {
|
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();
|
return E->getParamDecl()->getValueType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2340,7 +2340,7 @@ TypeExpr *PreCheckTarget::simplifyTypeExpr(Expr *E) {
|
|||||||
|
|
||||||
// When simplifying a type expr like "P1 & P2 -> P3 & P4 -> Int",
|
// When simplifying a type expr like "P1 & P2 -> P3 & P4 -> Int",
|
||||||
// it may have been folded at the same time; recursively simplify it.
|
// it may have been folded at the same time; recursively simplify it.
|
||||||
if (auto ArgsTypeExpr = simplifyTypeExpr(E))
|
if (auto ArgsTypeExpr = simplifyTypeExpr(E))
|
||||||
return ArgsTypeExpr->getTypeRepr();
|
return ArgsTypeExpr->getTypeRepr();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user