Skip to content

Conversation

kateinoigakukun
Copy link
Member

…ersions

When a non-throwing function is passed to a function that expects a
throwing function with an indirect error result, we need to create a
thunk because the indirect error result pointer is passed as an extra
trailing parameter. Extra trailing parameters except for `swifterror`
and `swiftself` are not allowed on some platforms like WebAssembly, so
they need to be called as exactly the same function signature.

```swift
func passThrough<X>(_ c: () throws(X) -> Void) throws(X) {
  try c()
}
func neverThrow() {}
passThrough(neverThrow)
```
@kateinoigakukun kateinoigakukun added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 labels Apr 22, 2024
@kateinoigakukun
Copy link
Member Author

@swift-ci test

@kateinoigakukun
Copy link
Member Author

@swift-ci test WebAssembly

@kateinoigakukun
Copy link
Member Author

@swift-ci test macOS

@MaxDesiatov
Copy link
Contributor

@swift-ci test macos

@MaxDesiatov MaxDesiatov added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. WebAssembly Platform: WebAssembly labels Apr 23, 2024
@kateinoigakukun kateinoigakukun marked this pull request as ready for review April 23, 2024 15:34
@kateinoigakukun kateinoigakukun requested a review from a team as a code owner April 23, 2024 15:34
@kateinoigakukun kateinoigakukun merged commit 753a361 into swiftlang:release/6.0 Apr 23, 2024
@kateinoigakukun kateinoigakukun deleted the yt/indirect-err-result-conv-6.0 branch April 26, 2024 06:12
@eeckstein
Copy link
Contributor

Tracked by rdar://128028703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. 🍒 release cherry pick Flag: Release branch cherry picks swift 6.0 WebAssembly Platform: WebAssembly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants