Skip to content

Commit 92bf897

Browse files
committed
Sema: Add a test case for unsupported existential type in 'where' clause
In Swift 5.3, we only checked the 'where' clause for unsupported existential types if the declaration was itself generic. If the declaration was only nested inside of another generic declaration, the check was skipped. This was fixed by the following refactoring but I didn't realize it at the time: commit c46eb22 Author: Slava Pestov <[email protected]> Date: Fri Jul 24 23:54:22 2020 -0400 AST: Don't attach trailing where clause requirements to the GenericParamList
1 parent b81afe3 commit 92bf897

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/type/protocol_types.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,8 @@ struct BadSubscript {
138138
set {}
139139
}
140140
}
141+
142+
struct OuterGeneric<T> {
143+
func contextuallyGenericMethod() where T == HasAssoc {}
144+
// expected-error@-1 {{protocol 'HasAssoc' can only be used as a generic constraint because it has Self or associated type requirements}}
145+
}

0 commit comments

Comments
 (0)