Skip to content

Commit 81a5a41

Browse files
committed
Move test for inheritance.
Swift SVN r6726
1 parent 4c7381c commit 81a5a41

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/decl/class/inherit/inherit.swift renamed to test/decl/inherit/inherit.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
// RUN: %swift -parse %s -verify
22

33
class A { }
4+
protocol P { }
45

56
// 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=}}
711

812
// Multiple inheritance
913
class C : B, A { } // expected-error{{multiple inheritance from classes 'B' and 'A'}}
1014

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+
1118
// Struct inheriting a class
1219
struct S : A { } // expected-error{{non-class type 'S' cannot inherit from class 'A'}}
1320

@@ -16,4 +23,3 @@ protocol Q : A { } // expected-error{{non-class type 'Q' cannot inherit from cla
1623

1724
// Extension inheriting a class
1825
extension C : A { } // expected-error{{extension of type 'C' cannot inherit from class 'A'}}
19-

0 commit comments

Comments
 (0)