Skip to content

Commit cc06572

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 9ec5a1d commit cc06572

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
@@ -1671,7 +1671,7 @@ class ApplyClassifier {
16711671
/// Check to see if the given function application throws, is async, or
16721672
/// involves unsafe behavior.
16731673
Classification classifyApply(
1674-
Expr *call,
1674+
ApplyExpr *call,
16751675
const AbstractFunction &fnRef,
16761676
Expr *calleeFn,
16771677
const AnyFunctionType *fnType,
@@ -1817,7 +1817,7 @@ class ApplyClassifier {
18171817
// to fix their code.
18181818
if (kind == EffectKind::Async &&
18191819
fnRef.getKind() == AbstractFunction::Function) {
1820-
if (auto *ctor = dyn_cast<ConstructorRefCallExpr>(calleeFn)) {
1820+
if (auto *ctor = dyn_cast<ConstructorRefCallExpr>(call->getFn())) {
18211821
if (ctor->getFn()->isImplicit() && args->isUnlabeledUnary())
18221822
result.setDowngradeToWarning(true);
18231823
}

0 commit comments

Comments
 (0)