[SR-288] Compiler crash after about 10 s (protocol ext, associated types, typealias)
| Previous ID | SR-288 |
| Radar | rdar://23598150 |
| Original Reporter | @jepers |
| Type | Bug |
| Status | Closed |
| Resolution | Cannot Reproduce |
Environment
OS X 10.11.2, Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 69940d166c)
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 24f5c3bccdbc93b40469f176e95fd5aa
Issue Description:
See demonstration below.
Notes about the example code: I'm using the concept of bits just to make the code a bit more concrete. The actual code where I encountered the bug has nothing to do with implementing type level bits ...
(Question: The compiler should of course not crash. But should this program compile without errors? If so, what should the last line print? If not, what should the error message say?)
$ cat > t.swift
protocol BitType {}
struct Clr : BitType {}
struct Set : BitType {}
protocol BitAndOp {
typealias A: BitType = Clr
typealias B: BitType = Clr
typealias Result: BitType = Clr
}
extension BitAndOp where A == B {
typealias Result = Set // This seems to declare a new Result, (since it's ok to set it to non-BitTypes) why?
}
struct And<T, U where T: BitType, U: BitType> : BitAndOp {
typealias A = T
typealias B = U
}
print(And<Set, Clr>.A.self) // Prints Set
print(And<Set, Clr>.B.self) // Prints Clr
print(And<Set, Clr>.Result.self) // Prints Clr (As expected, since A != B)
print(And<Set, Set>.A.self) // Prints Set
print(And<Set, Set>.B.self) // Prints Set
print(And<Set, Set>.Result.self) // This line crashes compiler after about ~10 seconds of work. Comment out and it compiles fine.
$ swiftc t.swift
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
(Tried with -O, whole module optimization etc, same compiler crash.)
@jopamer
Seems to have been fixed. Can't reproduce in Xcode 8 beta 4.