Files
swift-mirror/test/decl/inherit/inherit_anyobject_protocol_swift5.swift
Slava Pestov 8117052a1e Sema: Tweak a diagnostic
We talk about 'protocol refinement' rather than 'protocol inheritance';
but in this case, a more specific phrase makes even more sense, I think.
2021-01-07 23:48:00 -05:00

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}}