Skip to content

Commit 0540a2b

Browse files
committed
[TypeChecker] Update async initializer warning downgrade to check the call instead of callee
`calleeFn` now returns the underlying declaration reference looking through `ConstructorRefCallExpr`, which means the downgrade logic needs to check whether the call is using initializer reference before making a decision.
1 parent 09eb677 commit 0540a2b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Sema/TypeCheckEffects.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ class ApplyClassifier {
16721672
/// Check to see if the given function application throws, is async, or
16731673
/// involves unsafe behavior.
16741674
Classification classifyApply(
1675-
Expr *call,
1675+
ApplyExpr *call,
16761676
const AbstractFunction &fnRef,
16771677
Expr *calleeFn,
16781678
const AnyFunctionType *fnType,
@@ -1820,7 +1820,7 @@ class ApplyClassifier {
18201820
// to fix their code.
18211821
if (kind == EffectKind::Async &&
18221822
fnRef.getKind() == AbstractFunction::Function) {
1823-
if (auto *ctor = dyn_cast<ConstructorRefCallExpr>(calleeFn)) {
1823+
if (auto *ctor = dyn_cast<ConstructorRefCallExpr>(call->getFn())) {
18241824
if (ctor->getFn()->isImplicit() && args->isUnlabeledUnary())
18251825
result.setDowngradeToWarning(true);
18261826
}

0 commit comments

Comments
 (0)