Files
swift-mirror/test/Generics/canonicalization.swift
Doug Gregor 3452dda95c [GSB] Stop warning about 'bare' associated type redeclarations.
Associated type redeclarations occasionally occur to push around
associated type witness inference. Suppress the warning about redeclarations
that add no requirements (i.e., have neither an inheritance nor a
where clause).
2017-10-26 14:58:00 -07:00

21 lines
636 B
Swift

// RUN: %target-typecheck-verify-swift
// rdar://problem/23149063
protocol P0 { }
protocol P {
associatedtype A
}
protocol Q : P {
associatedtype A
}
func f<T>(t: T) where T : P, T : Q, T.A : P0 { } // expected-note{{'f(t:)' previously declared here}}
// expected-warning@-1{{redundant conformance constraint 'T': 'P'}}
// expected-note@-2{{conformance constraint 'T': 'P' implied here}}
func f<T>(t: T) where T : Q, T : P, T.A : P0 { } // expected-error{{invalid redeclaration of 'f(t:)'}}
// expected-warning@-1{{redundant conformance constraint 'T': 'P'}}
// expected-note@-2{{conformance constraint 'T': 'P' implied here}}