Closed KeithBauerANZ closed 3 months ago
Nice catch:
public protocol P {
associatedtype A
}
public struct G<A>: P {}
extension P where A == Int {
public init(integerLiteral: Int) {
fatalError()
}
}
extension G: ExpressibleByIntegerLiteral where A == Int {}
let _: G<Int> = 123
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: