A usage of `some` in closure return type that the compiler/Xcode seems to cope with exceptionally poorly

I just stumbled upon the very bad reaction that I received from the compiler/Xcode upon writing this function:

func foo () {
    var test: ()->some Equatable = { ()->Int in 0 }
}

If I paste this function into a fresh package I get only one error (not associated with any line of code): Command CompileSwift failed with a nonzero exit code, which shows me no additional detail underneath it when I click on it. Additionally, Xcode displays the message An internal error occurred. Source editor functionality is limited. Attempting to restore....

I can reproduce this in the Swift REPL too. The compiler should never crash even with malformed input, so this would be a great case to report as a bug.

2 Likes

Filed :+1:

2 Likes