Skip to content

Commit 79a51df

Browse files
committed
Move resolving param type to CSApply
1 parent ae35500 commit 79a51df

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

lib/Sema/CSApply.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -3247,6 +3247,18 @@ namespace {
32473247
auto toType = simplifyType(cs.getType(expr));
32483248
ASSERT(toType->isEqual(expr->getParamDecl()->getValueType()));
32493249
cs.setType(expr, toType);
3250+
3251+
auto declRefRepr = cast<DeclRefTypeRepr>(expr->getRepr());
3252+
auto resolvedTy =
3253+
TypeResolution::resolveContextualType(declRefRepr, cs.DC,
3254+
TypeResolverContext::InExpression,
3255+
nullptr, nullptr, nullptr);
3256+
3257+
if (!resolvedTy || resolvedTy->hasError())
3258+
return nullptr;
3259+
3260+
expr->setParamType(resolvedTy);
3261+
32503262
return expr;
32513263
}
32523264

lib/Sema/CSGen.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -1723,15 +1723,6 @@ namespace {
17231723
}
17241724

17251725
Type visitTypeValueExpr(TypeValueExpr *E) {
1726-
auto declRefRepr = cast<DeclRefTypeRepr>(E->getRepr());
1727-
auto resolvedTy = resolveTypeReferenceInExpression(declRefRepr,
1728-
TypeResolverContext::InExpression,
1729-
CS.getConstraintLocator(E));
1730-
1731-
if (!resolvedTy || resolvedTy->hasError())
1732-
return Type();
1733-
1734-
E->setParamType(resolvedTy);
17351726
return E->getParamDecl()->getValueType();
17361727
}
17371728

lib/Sema/PreCheckTarget.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2340,7 +2340,7 @@ TypeExpr *PreCheckTarget::simplifyTypeExpr(Expr *E) {
23402340

23412341
// When simplifying a type expr like "P1 & P2 -> P3 & P4 -> Int",
23422342
// it may have been folded at the same time; recursively simplify it.
2343-
if (auto ArgsTypeExpr = simplifyTypeExpr(E))
2343+
if (auto ArgsTypeExpr = simplifyTypeExpr(E))
23442344
return ArgsTypeExpr->getTypeRepr();
23452345
return nullptr;
23462346
};

0 commit comments

Comments
 (0)