-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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 mixing ==
constraints with default implementations of protocol methods (Swift 6 regression)
#74465
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
conformances
Feature → protocol: protocol conformances
crash
Bug: A crash, i.e., an abnormal termination of software
generics
Feature: generic declarations and types
Comments
KeithBauerANZ
added
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
crash
Bug: A crash, i.e., an abnormal termination of software
triage needed
This issue needs more specific labels
labels
Jun 16, 2024
KeithBauerANZ
changed the title
Compiler crash mixing
Compiler crash mixing Jun 23, 2024
==
constraints with default implementations of protocol methods==
constraints with default implementations of protocol methods (Swift 6 regression)
hamishknight
added
compiler
The Swift compiler itself
conformances
Feature → protocol: protocol conformances
generics
Feature: generic declarations and types
and removed
triage needed
This issue needs more specific labels
labels
Jun 24, 2024
Nice catch:
|
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jun 28, 2024
Adding `T == Int` to G1 := <T where T: Equatable> gives us G2 := <T where T == Int> which means that if I have this substitution map for G2: S2 := { Int } then `SubstitutionMap::get(G1, S2)` should give me this substitution map for G1: S2 := { Int, [Int: Equatable] } But it didn't, instead returning a substitution map with an invalid conformance. The problem is that local conformance lookup alone cannot recover `[Int: Equatable]` in this case, because there is no "concrete conformance requirement" `[T == Int: Equatable]` recorded anywhere in G2. This is of course a legacy of the GenericSignatureBuilder. It would have been better to not drop conformance requirements made concrete. But oh well. Fixes swiftlang#74465 Fixes rdar://130404629.
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jun 28, 2024
Adding `T == Int` to G1 := <T where T: Equatable> gives us G2 := <T where T == Int> which means that if I have this substitution map for G2: S2 := { Int } then `SubstitutionMap::get(G1, S2)` should give me this substitution map for G1: S2 := { Int, [Int: Equatable] } But it didn't, instead returning a substitution map with an invalid conformance. The problem is that local conformance lookup alone cannot recover `[Int: Equatable]` in this case, because there is no "concrete conformance requirement" `[T == Int: Equatable]` recorded anywhere in G2. This is of course a legacy of the GenericSignatureBuilder. It would have been better to not drop conformance requirements made concrete. But oh well. Fixes swiftlang#74465 Fixes rdar://130404629.
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jun 28, 2024
Adding `T == Int` to G1 := <T where T: Equatable> gives us G2 := <T where T == Int> which means that if I have this substitution map for G2: S2 := { Int } then `SubstitutionMap::get(G1, S2)` should give me this substitution map for G1: S2 := { Int, [Int: Equatable] } But it didn't, instead returning a substitution map with an invalid conformance. The problem is that local conformance lookup alone cannot recover `[Int: Equatable]` in this case, because there is no "concrete conformance requirement" `[T == Int: Equatable]` recorded anywhere in G2. This is of course a legacy of the GenericSignatureBuilder. It would have been better to not drop conformance requirements made concrete. But oh well. Fixes swiftlang#74465 Fixes rdar://130404629.
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jun 28, 2024
Adding `T == Int` to G1 := <T where T: Equatable> gives us G2 := <T where T == Int> which means that if I have this substitution map for G2: S2 := { Int } then `SubstitutionMap::get(G1, S2)` should give me this substitution map for G1: S2 := { Int, [Int: Equatable] } But it didn't, instead returning a substitution map with an invalid conformance. The problem is that local conformance lookup alone cannot recover `[Int: Equatable]` in this case, because there is no "concrete conformance requirement" `[T == Int: Equatable]` recorded anywhere in G2. This is of course a legacy of the GenericSignatureBuilder. It would have been better to not drop conformance requirements made concrete. But oh well. Fixes swiftlang#74465 Fixes rdar://130404629.
slavapestov
added a commit
to slavapestov/swift
that referenced
this issue
Jul 1, 2024
Adding `T == Int` to G1 := <T where T: Equatable> gives us G2 := <T where T == Int> which means that if I have this substitution map for G2: S2 := { Int } then `SubstitutionMap::get(G1, S2)` should give me this substitution map for G1: S2 := { Int, [Int: Equatable] } But it didn't, instead returning a substitution map with an invalid conformance. The problem is that local conformance lookup alone cannot recover `[Int: Equatable]` in this case, because there is no "concrete conformance requirement" `[T == Int: Equatable]` recorded anywhere in G2. This is of course a legacy of the GenericSignatureBuilder. It would have been better to not drop conformance requirements made concrete. But oh well. Fixes swiftlang#74465 Fixes rdar://130404629.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
conformances
Feature → protocol: protocol conformances
crash
Bug: A crash, i.e., an abnormal termination of software
generics
Feature: generic declarations and types
Description
Not quite sure what's going on here, but the code compiles with Swift 5.10/Xcode 15.4, and crashes the compiler with Swift 6/Xcode 16.0b1. Replacing
where RawValue == String
constraints withwhere RawValue: ExpressibleByXXXLiteral
constraints also solves the problem.Reproduction
Stack dump
Expected behavior
A diagnostic, if the code is invalid, but probably it should compile?
Environment
xcodebuild -version
Xcode 16.0
Build version 16A5171c
Additional information
Working version:
The text was updated successfully, but these errors were encountered: