Files
swift-mirror/lib/SILGen/SILGenFunction.cpp
Anthony Latsis f3d8e53f0e SILGen: Fix effective thrown error type for integrated function conversion emission
Sometimes, as an optimization, we fulfill a function conversion
expression that wraps a closure literal by adjusting the emission of the
closure function instead of emitting a thunk. For example, the following
closure is emitted as an untyped throws function, and the errors thrown
in its body are type-erased:

```swift
func foo<E: Error>(e: E) {
  let _: () throws -> Void = { () throws(E) -> Void in
    throw e
  }
}
```

Be careful not to rely on the thrown error type stored in the AST node,
since it may differ from the effective thrown error type tracked by
SILGen.

Fixes rdar://169150387.
2026-02-13 20:12:18 +00:00

81 KiB