[SR-10814] Incorrect compiler error with try + autoclosure inside another closure #53204
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Environment
macOS 10.14.5
Xcode 10.2.1
Swift 5.0
Additional Detail from JIRA
md5: cece38381f5ed1ae82c7f2f657ef1657
duplicates:
Issue Description:
Steps to reproduce
Create a new Swift playground.
Paste the code below into it.
Attempt to run it.
Expected Result
The code should compile and run.
Actual Result
The code does not compile. The compiler reports an error on the
failsToCompile
declaration:Discussion
The sample code contains a function –
takesThrowingClosureButDoesNotRethrow
– that has as an@autoclosure
throwing closure argument, but does not "rethrow" errors.Calling this function with a throwing expression from the top level of the playground, or from inside a function works as expected. But, doing the same from inside a closure results in a compiler error.
One other note: Removing the
@autoclosure
annotation and explicitly passing `{ try throwingOperation() }` works in all cases.The text was updated successfully, but these errors were encountered: