Unexpected compiler error when passing function as parameter to rethrows function #74305
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
concurrency
Feature: umbrella label for concurrency language features
typed throws
Feature → error handling → throws & rethrows: Typed throws
Description
When passing a function as a parameter to a rethrows function instead of providing a closure, an unexpected compiler error is thrown, stating that the function call can throw, which is not the case. Calling the same function from within a closure is ok. The error does not seem to occur when
@MainActor
attribute is removed from the function. This error does not occur on Swift 5.10.Reproduction
Expected behavior
The code compiles
Environment
swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-macosx15.0
Additional information
Edit: This only seems to occur when Swift 6 language mode is enabled
The text was updated successfully, but these errors were encountered: