mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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 https://github.com/swiftlang/swift/issues/74465
Fixes rdar://130404629.
20 lines
322 B
Swift
20 lines
322 B
Swift
// RUN: %target-swift-emit-silgen %s
|
|
|
|
public protocol P {
|
|
associatedtype A : Equatable
|
|
}
|
|
|
|
public struct G<A: Equatable>: P {}
|
|
|
|
extension P where A == Int {
|
|
public init(integerLiteral: Int) {
|
|
fatalError()
|
|
}
|
|
}
|
|
|
|
extension G: ExpressibleByIntegerLiteral where A == Int {}
|
|
|
|
public func f() -> G<Int> {
|
|
return 123
|
|
}
|