mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
25 lines
869 B
Swift
25 lines
869 B
Swift
// RUN: %target-swift-frontend -typecheck -debug-generic-signatures %s -warn-redundant-requirements 2>&1 | %FileCheck %s
|
|
// RUN: %target-swift-frontend -verify -emit-ir %s -warn-redundant-requirements
|
|
|
|
public protocol P {
|
|
associatedtype Element
|
|
}
|
|
|
|
public class C<O: P>: P {
|
|
public typealias Element = O.Element
|
|
}
|
|
|
|
// CHECK: Generic signature: <T, O, E where T : C<E>, O : P, E : P, O.[P]Element == E.[P]Element>
|
|
public func toe1<T, O, E>(_: T, _: O, _: E, _: T.Element)
|
|
where T : P, // expected-warning {{redundant conformance constraint 'C<E>' : 'P'}}
|
|
O : P,
|
|
O.Element == T.Element,
|
|
T : C<E> {}
|
|
|
|
// CHECK: Generic signature: <T, O, E where T : C<E>, O : P, E : P, O.[P]Element == E.[P]Element>
|
|
public func toe2<T, O, E>(_: T, _: O, _: E, _: T.Element)
|
|
where O : P,
|
|
O.Element == T.Element,
|
|
T : C<E> {}
|
|
|