Avatar
Avatar
trickart
@swift-6.2 enum FooError: Error { case bar } var closure2: (() throws(FooError) -> Int)? closure2 = { throws(FooError) in throw .bar }
exit status 1 with stderr:<stdin>:5:14: error: expected expression 3 | var closure2: (() throws(FooError) -> Int)? 4 | 5 | closure2 = { throws(FooError) in throw .bar } | `- error: expected expression 6 | <stdin>:5:10: error: invalid conversion of thrown error type 'any Error' to 'FooError' 3 | var closure2: (() throws(FooError) -> Int)? 4 | 5 | closure2 = { throws(FooError) in throw .bar } | `- error: invalid conversion of thrown error type 'any Error' to 'FooError' 6 | <stdin>:5:41: error: type 'any Error' has no member 'bar' 3 | var closure2: (() throws(FooError) -> Int)? 4 | 5 | closure2 = { throws(FooError) in throw .bar } | `- error: type 'any Error' has no member 'bar' 6 |