Skip to content

Commit 158bf61

Browse files
[test] Adding specific tests for the warning for protocol inheritance class keyword syntax deprecation
1 parent c29fbb5 commit 158bf61

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol P: class {}
4+
protocol P1: AnyObject {}
5+
protocol P2 {}
6+
protocol P3: class, P2 {}
7+
protocol P4: P2, class {} // expected-error {{'class' must come first in the requirement list}}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-typecheck-verify-swift -swift-version 5
2+
3+
protocol P: class {}
4+
// expected-warning@-1 {{using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead}} {{13-18=AnyObject}}
5+
protocol P1: AnyObject {}
6+
protocol P2 {}
7+
protocol P3: class, P2 {}
8+
// expected-warning@-1 {{using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead}} {{14-19=AnyObject}}
9+
protocol P4: P2, class {} // expected-error {{'class' must come first in the requirement list}}
10+
// expected-warning@-1 {{using 'class' keyword for protocol inheritance is deprecated; use 'AnyObject' instead}} {{18-23=AnyObject}}

0 commit comments

Comments
 (0)