New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SR-10305] Type Checker SegFault #52705
Comments
This doesn't crash on 5.1 (near master), but it does crash for me on 5.0 (Xcode 10.2). |
4.2
5.0:
|
5.1 error: initializer 'init(exactly:)' requires that 'Substring' conform to 'BinaryInteger'
guard let major: Int = components.first.flatMap(Int.init) else { return nil }
^
Swift.SignedInteger:3:23: note: where 'T' = 'Substring'
@inlinable public init?<T>(exactly source: T) where T : BinaryInteger
^ |
I don't think Int has an initializer from Substring (or StringProtocol), but it shouldn't crash. Thanks, Caleb. |
Comment by Caleb Kleveter (JIRA) Alright, that's what I suspected. |
This should be addressed by one of my PRs in 5.1/master and produces diagnostic @theblixguy mentioned. Unfortunately the change didn't make it in time for 5.0 release... Please verify using the latest 5.1/master snapshot. |
calebkleveter (JIRA User), Could you verify if the problem is fixed and if so move the JIRA to "Closed"? Thanks! |
Comment by Caleb Kleveter (JIRA) Yep! I get the expected compiler error now. |
Environment
Apple Swift version 5.0 (swiftlang-1001.0.69.5 clang-1001.0.46.3)
Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA
md5: e4a5f8345ebf8ab1fdd4181d3edcf4df
is duplicated by:
Issue Description:
The Swift 5 type checker is crashing with a segfault when I try to convert an optional Substring to an Int:
The program compiles if I map over the Substring array and convert them so Strings.
Here is the gist with the compiler output: https://gist.github.com/calebkleveter/e6a7f3943b50e022ecd2beefbed44a6e
The crash occurs in both Xcode and the Terminal.
The text was updated successfully, but these errors were encountered: