Skip to content

Commit 11e3d00

Browse files
authored
Merge pull request #60386 from theblixguy/discardable-result-look-through-func-conv-5.7
[5.7] [Sema] Look through FunctionConversionExpr when finding @discardableResult callee
2 parents f6eaa13 + 2a9d56f commit 11e3d00

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/Sema/TypeCheckStmt.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1412,6 +1412,8 @@ void TypeChecker::checkIgnoredExpr(Expr *E) {
14121412
fn = FVE->getSubExpr();
14131413
} else if (auto dotSyntaxRef = dyn_cast<DotSyntaxBaseIgnoredExpr>(fn)) {
14141414
fn = dotSyntaxRef->getRHS();
1415+
} else if (auto fnConvExpr = dyn_cast<FunctionConversionExpr>(fn)) {
1416+
fn = fnConvExpr->getSubExpr();
14151417
} else {
14161418
break;
14171419
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-typecheck-verify-swift -disable-availability-checking
2+
// REQUIRES: concurrency
3+
4+
// https://github.com/apple/swift/issues/60276
5+
6+
@discardableResult @MainActor
7+
func mainActorAsyncDiscardable() async -> Int { 0 }
8+
9+
func consumesMainActorAsyncDiscardable() async {
10+
await mainActorAsyncDiscardable() // ok
11+
}

0 commit comments

Comments
 (0)