-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Compiler Crash on nested associatedtype (5.7 XCode beta6) #60900
Comments
|
This is also FB11427468 |
|
/cc @slavapestov |
|
The following reduction attempt does not reach the more descriptive abortion, and hits an immediately preceding protocol P {
associatedtype A
}
protocol Q {
associatedtype B: P
}
class C1 {}
class C2: C1, P, Q {
typealias A = C2
typealias B = C2
}
class Foo<T: Q> where T == T.B.A, T.B: C1 {}
extension Foo where T == C2 {} |
|
I just checked XCode 14 RC and it seems like it is shipped with this bug... Is there any workaround? |
|
That release note is out of date. rdar://91594361 was fixed in beta 3. The bug you're seeing here is a different bug. |
|
rdar://99438489 |
|
Thanks @slavapestov for the detail. Strangely adding that flag to XCode makes the code compile/link without any issues! 🤔 |
|
Yes that flag also works around this bug too. Is this code example also reduced from Realm-swift? |
|
It is originally from a wrapper for RealmSwift but the code I attached has nothing to do with realmSwift and crashes the 5.7 (XCode 14 RC, without that flag) as standalone. You can just copy the snippet in a |
|
The bug is in the 'concrete contraction' pass of the requirement machine, which I need to remove at some point... in the mean time I'll come up with a fix. |
When can we expect this fix ? |
|
Hi, do you have any news ? |
|
Not yet, sorry. Does the workaround of building with |
I confirm that the workaround works. We have production code using it. |
This workaround does not works for us. We still have this kind of errors with your OTHER_SWIFT_FLAGS value. |
|
@ThomasD-WL this looks like a different example judging by the protocol names in the debug output. Can you share a test case? |
|
@slavapestov the existing workaround seems to be broken in XCode 14.3 ! The |
Because the old generics implementation was completely removed in 5.8. The best thing that comes to mind now that switching off the requirement machine is no longer an option is to locate the offending same-type constraint ( |

Describe the bug
Compiler Crash using Swift 5.7 (XCode 14-Beta6) on the following code snippet. Just run
swift test.swift(use v5.7 on XCode14-beta6).Steps to reproduce:
Compile the attached code using Swift 5.7 - Xcode14-beta6. Compiles fine on 5.6 & before.
Expected behavior
The compiler should not crash but emit a diagnostic error.
Code
Environment (please fill out the following information)
Crash Dump
The text was updated successfully, but these errors were encountered: