Open
Description
Description
The following test triggers an infinite loop where the stack trace repeats the following two items:
swift_getAssociatedConformanceWitnessSlow ()
associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
Reproduction
import Testing
@Test
func demo_EXC_BAD_ACCESS() {
_ = C1<A1<Int>, Int>().foo
}
protocol A0 {
associatedtype C: C0<Self>
}
protocol B0<K>: A0 where C: D0<K> {
associatedtype K: Hashable
}
protocol C0<A> {
associatedtype A: A0
}
protocol D0<K>: C0 {
associatedtype K: Hashable
}
struct A1<K: Hashable>: B0 {
typealias C = C1<Self, K>
typealias K = K
}
struct C1<A: B0<K>, K: Hashable>: D0 {
var foo: Set<K> { [] }
}
extension Int: A0 {
struct C: C0 {
typealias A = Int
}
}
Stack dump
#0 0x00000001066323bc in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#1 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#2 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#3 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#4 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
[...]
#7415 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7416 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7417 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7418 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7419 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7420 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7421 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7422 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7423 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7424 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7425 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7426 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7427 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7428 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7429 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7430 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7431 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7432 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7433 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7434 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7435 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7436 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7437 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7438 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7439 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7440 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7441 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7442 0x0000000106632434 in associated type witness table accessor for D0.K : Hashable in C1<A, B> ()
#7443 0x00000001a4e9e064 in swift_getAssociatedConformanceWitnessSlow ()
#7444 0x0000000106632118 in C1.foo.getter at {line of getter}
#7445 0x0000000106631b98 in demo_EXC_BAD_ACCESS() at {line of test}
Expected behavior
That the compiler emits an error if the code is unsound, or that it doesn't crash at runtime.
Environment
Swift 6.1
Xcode Version 16.4 (16F6)
Additional information
No response