Skip to content

Commit 329e2c5

Browse files
committed
Make sure Self constraints in classes remain illegal
1 parent db3f708 commit 329e2c5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/Generics/where_clause_contextually_generic_decls.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
// RUN: %target-typecheck-verify-swift -typecheck %s -verify -swift-version 4
22

3+
// Make sure Self: ... is correctly diagnosed in classes
4+
5+
class SelfInGenericClass<T> {
6+
// expected-error@+1 {{type 'Self' in conformance requirement does not refer to a generic parameter or associated type}}
7+
func foo() where Self: Equatable { }
8+
// expected-error@+1 {{generic signature requires types 'Self' and 'Bool' to be the same}}
9+
func bar() where Self == Bool { }
10+
}
11+
312
protocol Whereable {
413
associatedtype Assoc
514
associatedtype Bssoc

0 commit comments

Comments
 (0)