#expect(try ...)
from inside a closure causes "errors thrown from here are not handled" error
#78395
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Description
When the expression passed to
#expect()
containstry
, and the#expect()
call occurs inside a throwing closure, the compiler emits an "errors thrown from here are not handled" error.Verified using Xcode 16.2, release/6.1 dev snapshot (2024-12-21), and main dev snapshot (2024-12-22).
Expected behavior
The
try
keyword should be usable inside the#expect()
macro, as it is under non-closure conditions.Actual behavior
The compiler refuses to compile the expression.
Steps to reproduce
See attached reproducer: TestPackage.zip
swift-testing version/commit hash
6.0.3
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: