// RUN: %target-typecheck-verify-swift // RUN: not %target-swift-frontend -typecheck %s -debug-generic-signatures 2>&1 | %FileCheck %s protocol P {} struct S {} class C : P {} extension S where T : P { // expected-note {{where 'T' = 'T'}} typealias A = Int typealias B = S } extension S where T == Float { // expected-note {{requirement specified as 'T' == 'Float' [with T = Int]}} typealias C = Int } class A {} // CHECK-LABEL: ExtensionDecl line={{.*}} base=A // CHECK-NEXT: Generic signature: extension A where T == [U], U: P { typealias S1 = Int } // CHECK-LABEL: ExtensionDecl line={{.*}} base=A // CHECK-NEXT: Generic signature: extension A where T == [U], U == Int { // expected-note@-1 {{requirement specified as 'T' == '[Int]' [with T = [String]]}} typealias S2 = Int } class B : A<[U], U> {} _ = B.S1() // Ok _ = B.S2() // Ok _ = B.S1() // expected-error {{type 'Float' does not conform to protocol 'P'}} _ = B.S2() // expected-error@-1 {{'A.S2' (aka 'Int') requires the types '[String]' and '[Int]' be equivalent}} _ = S.A() // Ok _ = S.A() // expected-error {{type 'Int' does not conform to protocol 'P'}} _ = S.B() // expected-error {{type 'String' does not conform to protocol 'P'}} _ = S.C() // expected-error {{'S.C' (aka 'Int') requires the types 'Int' and 'Float' be equivalent}} func foo(_ s: S.Type) { _ = s.A() // expected-error {{referencing type alias 'A' on 'S' requires that 'T' conform to 'P'}} } func bar(_ s: S.Type) { _ = s.A() // Ok }