File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
// RUN: %swift -parse %s -verify
2
2
3
3
class A { }
4
+ protocol P { }
4
5
5
6
// Duplicate inheritance
6
- class B : A , A { } // expected-error{{duplicate inheritance from class 'A'}}{{12-15=}}
7
+ class B : A , A { } // expected-error{{duplicate inheritance from 'A'}}{{12-15=}}
8
+
9
+ // Duplicate inheritance from protocol
10
+ class B2 : P , P { } // expected-error{{duplicate inheritance from 'P'}}{{13-16=}}
7
11
8
12
// Multiple inheritance
9
13
class C : B , A { } // expected-error{{multiple inheritance from classes 'B' and 'A'}}
10
14
15
+ // Superclass in the wrong position
16
+ class D : P , A { } // expected-error{{superclass 'A' must appear first in the inheritance clause}}{{12-15=}}{{11-11=A, }}
17
+
11
18
// Struct inheriting a class
12
19
struct S : A { } // expected-error{{non-class type 'S' cannot inherit from class 'A'}}
13
20
@@ -16,4 +23,3 @@ protocol Q : A { } // expected-error{{non-class type 'Q' cannot inherit from cla
16
23
17
24
// Extension inheriting a class
18
25
extension C : A { } // expected-error{{extension of type 'C' cannot inherit from class 'A'}}
19
-
You can’t perform that action at this time.
0 commit comments