You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.0.0
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug
Assignee
None
Priority
Medium
md5: 9e5251ad46a4b3a91273acd21faf71de
duplicates:
SR-487 Compiler fails to consider @autoclosure when satisfying try requirements
Issue Description:
below shows a reduced sample, the compiler attempt to hoist @autoclosure content as a statement of the call-site which leads a compile error, this is not the designated behavior
the commentted line will raise an `Invalid conversion from throwing function of type '() throws -> Either<Error, Int>' to non-throwing function type '() -> _'` error
publicenumEither<L,R>{case Left(L)case Right(R)}func mayThrow()throws->Int{return100}func measureNano<T>(_ block:()->T)->(Int,T){return(0,block())}func rescue<T>(_ block:@autoclosure()throws->T)->Either<Error,T>{do{return.Right(tryblock())}catch{return.Left(error)}}func main(){measureNano{// this line will raise a compiler error rescue(trymayThrow())}}
The text was updated successfully, but these errors were encountered:
Environment
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)
Target: x86_64-apple-darwin18.0.0
Additional Detail from JIRA
md5: 9e5251ad46a4b3a91273acd21faf71de
duplicates:
Issue Description:
below shows a reduced sample, the compiler attempt to hoist @autoclosure content as a statement of the call-site which leads a compile error, this is not the designated behavior
the commentted line will raise an `Invalid conversion from throwing function of type '() throws -> Either<Error, Int>' to non-throwing function type '() -> _'` error
The text was updated successfully, but these errors were encountered: