Sema: The primary associated type list references existing associated types instead of declaring new ones

This commit is contained in:
Slava Pestov
2022-04-03 21:11:01 -04:00
parent ecf8a35dc1
commit 8c47cd75fd
18 changed files with 149 additions and 164 deletions

View File

@@ -2,15 +2,19 @@
// RUN: %target-swift-frontend -typecheck -module-name ParameterizedProtocols -emit-module-interface-path %t/ParameterizedProtocols.swiftinterface -enable-parameterized-protocol-types %s
// RUN: %FileCheck %s < %t/ParameterizedProtocols.swiftinterface
public protocol HasPrimaryAssociatedTypes<T, U : Collection, V : Equatable = Int> where U.Element == Int {}
public protocol HasPrimaryAssociatedTypes<T, U> {
associatedtype T : Collection where T.Element == U
associatedtype U : Equatable
}
// CHECK: #if compiler(>=5.3) && $PrimaryAssociatedTypes
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes<T, U : Swift.Collection, V : Swift.Equatable = Swift.Int> where Self.U.Element == Swift.Int {
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes<T, U> {
// CHECK-NEXT: associatedtype T : Swift.Collection
// CHECK-NEXT: associatedtype U : Swift.Equatable where Self.U == Self.T.Element
// CHECK-NEXT: }
// CHECK-NEXT: #else
// CHECK-NEXT: public protocol HasPrimaryAssociatedTypes {
// CHECK-NEXT: associatedtype T
// CHECK-NEXT: associatedtype U : Swift.Collection where Self.U.Element == Swift.Int
// CHECK-NEXT: associatedtype V : Swift.Equatable = Swift.Int
// CHECK-NEXT: associatedtype T : Swift.Collection
// CHECK-NEXT: associatedtype U : Swift.Equatable where Self.U == Self.T.Element
// CHECK-NEXT: }
// CHECK-NEXT: #endif