Files
swift-mirror/test/Generics/sr11153.swift
Slava Pestov c18d57a346 XFAIL a test that fails due to a new GSB assert
I added this test case in https://github.com/apple/swift/pull/36402;
the change in https://github.com/apple/swift/pull/36411 correctly
flags some bogus same-type requirements in a minimized signature
and asserts.
2021-03-12 11:23:50 -05:00

25 lines
947 B
Swift

// RUN: %target-swift-frontend -typecheck -debug-generic-signatures %s 2>&1 | not %FileCheck %s
// RUN: %target-swift-frontend -emit-ir %s
// XFAIL: asserts
// CHECK: Requirement signature: <Self where Self.Field : FieldAlgebra>
public protocol VectorSpace {
associatedtype Field: FieldAlgebra
}
// CHECK: Requirement signature: <Self where Self : VectorSpace, Self == Self.Field, Self.ComparableSubalgebra : ComparableFieldAlgebra>
public protocol FieldAlgebra: VectorSpace where Self.Field == Self {
associatedtype ComparableSubalgebra: ComparableFieldAlgebra
static var zero: Self { get }
}
// CHECK: Requirement signature: <Self where Self : FieldAlgebra, Self == Self.ComparableSubalgebra>
public protocol ComparableFieldAlgebra: FieldAlgebra where Self.ComparableSubalgebra == Self {
}
// CHECK: Generic signature: <F where F : FieldAlgebra>
public func test<F: FieldAlgebra>(_ f: F) {
_ = F.ComparableSubalgebra.zero
}