mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
We talk about 'protocol refinement' rather than 'protocol inheritance'; but in this case, a more specific phrase makes even more sense, I think.
11 lines
683 B
Swift
11 lines
683 B
Swift
// RUN: %target-typecheck-verify-swift -swift-version 5
|
|
|
|
protocol P: class {}
|
|
// expected-warning@-1 {{using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead}} {{13-18=AnyObject}}
|
|
protocol P1: AnyObject {}
|
|
protocol P2 {}
|
|
protocol P3: class, P2 {}
|
|
// expected-warning@-1 {{using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead}} {{14-19=AnyObject}}
|
|
protocol P4: P2, class {} // expected-error {{'class' must come first in the requirement list}}
|
|
// expected-warning@-1 {{using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead}} {{18-23=AnyObject}}
|