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
tkrajacic opened this issue
Oct 19, 2016
· 4 comments
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareSILGenArea → compiler: The SIL generation stage
SR-3191 Compiler crashes when compiling extension for struct
Issue Description:
The following crashes the compiler in Xcode 8.1 beta and the latest snapshots (tested with DEVELOPMENT-SNAPSHOT-2016-10-14-a).
An example project is attached.
Two files:
publicstructItem {
publicenumVersion: Int {
caseversion1 = 1
}
// skipping the default value and doing it in initializers also makes compiler happypublicvarversion: Version = .version1init() {
/* version = .version1 */
}
}
// Putting the extension here works fine//extension Item {// public init(a dictionary: [String: Any]) throws { }//}
and
// Putting the extension here crashesextensionItem {
publicinit(dictionary: Any) { /* version = .version1 */ }
}
The comments above the extension describe one crash case. When the extension is in the second file the compiler crashes, is it in the same file as the definition there is no problem.
The second variant to make the compiler happy is to comment out the default value assignment in the struct's definition and assigning the default values in the initializers. Then the extension can be in the second file.
While the compiler doesn't crash anymore, SourceKit crashes all the time when putting the extension in another file.
I am using the latest snapshot (2017-01-04) and latest Xcode (8.2.1)
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of softwareSILGenArea → compiler: The SIL generation stage
Attachment: Download
Environment
MacOS Sierra, Xcode 8.1 beta, Macbook Early 2016
Additional Detail from JIRA
md5: a6c9b28d72699b7829d2c24bec07005b
relates to:
Issue Description:
The following crashes the compiler in Xcode 8.1 beta and the latest snapshots (tested with DEVELOPMENT-SNAPSHOT-2016-10-14-a).
An example project is attached.
Two files:
and
The comments above the extension describe one crash case. When the extension is in the second file the compiler crashes, is it in the same file as the definition there is no problem.
The second variant to make the compiler happy is to comment out the default value assignment in the struct's definition and assigning the default values in the initializers. Then the extension can be in the second file.
Xcode log:
The text was updated successfully, but these errors were encountered: