-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Previous ID | SR-13887 |
Radar | rdar://problem/71677775 |
Original Reporter | ken (JIRA User) |
Type | Bug |
Environment
Xcode "Version 12.0.1 (12A7300)".
Above the stack trace, it says: "Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)"
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 654d4c44de8b60abe51e70a344291715
Issue Description:
I was writing a Swift program in Xcode 12 (Swift 5.3), and I started consistently crashing the compiler. I made a copy of the project and started removing pieces until I found what I believe is a fairly minimal example.
I'll prefix this by saying: I know this isn't a valid Swift program. I was adding conformance to a protocol, and I couldn't remember the protocol definition, so I was going to declare conformance and have Xcode show the error with the "Add stubs?" fixer. But it just kept segfaulting.
In file A.swift:
class E {
func n(_ num: N) { }
}
func test() {
let e = E()
e.n(5)
}
In file B.swift:
struct N {
let str: String
init(_ int: Int) {
self.str = String(int)
}
}
extension N: ExpressibleByIntegerLiteral {
}
Curiously, Xcode reports "Command CompileSwift failed with a nonzero exit code", but changing almost any remaining aspect of this program (for example, commenting out the "self.str = String(int)" line, or the "e.n(5)" line, or even putting all the code in one file) changes the error to "Type 'N' does not conform to protocol 'ExpressibleByIntegerLiteral'" – which is what I expected in the first place.