Open
Description
Description
Sorry, I'm having a hard time coming up with a good title for this. Here's the simplest example I've been able to create:
Reproduction
protocol FloatingPointScalar: SIMDScalar & BinaryFloatingPoint & Codable {
associatedtype Matrix2x2: Matrix2x2Protocol
}
protocol FloatingPointVector: SIMD where Scalar: FloatingPointScalar {
// Uncomment this to crash the compiler.
// associatedtype Matrix2
}
extension SIMD2: FloatingPointVector where Scalar: FloatingPointScalar {
typealias Matrix2 = Scalar.Matrix2x2
}
protocol SquareMatrix {
associatedtype Scalar
associatedtype Vector: FloatingPointVector
}
protocol Matrix2x2Protocol: SquareMatrix where Vector == SIMD2<Scalar> {
// I want to use `Vector.Matrix2` here.
// static var test: Vector.Matrix2 { get }
}
Stack dump
Command SwiftCompile failed with a nonzero exit code
Expected behavior
I can use that associatedtype Matrix2
.
Environment
swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1)
Target: arm64-apple-macosx14.0
Additional information
Here's the real use case:
https://github.com/Catterwaul/SIMDson/tree/main/Sources/FloatingPoint/Matrix
Metadata
Metadata
Assignees
Labels
Bug → crash: An assertion failureFeature → declarations → protocol: `associatedtype` declarationsA deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: A crash, i.e., an abnormal termination of softwareFeature: generic declarations and typesFeature → type declarations: Protocol declarationsArea → compiler: Semantic analysis