Skip to content

Commit e2ed202

Browse files
committed
Unlock Parameterized Existentials Behind 'any'
1 parent 635d253 commit e2ed202

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

lib/Sema/TypeCheckType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,12 @@ class TypeResolutionOptions {
282282
case Context::Inherited:
283283
case Context::ExtensionBinding:
284284
case Context::GenericRequirement:
285+
case Context::ExistentialConstraint:
285286
return true;
286287
case Context::None:
287288
case Context::TypeAliasDecl:
288289
case Context::GenericTypeAliasDecl:
289290
case Context::MetatypeBase:
290-
case Context::ExistentialConstraint:
291291
case Context::InExpression:
292292
case Context::ExplicitCastExpr:
293293
case Context::ForEachStmt:

test/type/parameterized_protocol.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,8 @@ func returnsSequenceOfInt1() -> Sequence<Int> {}
158158
// expected-error@-1 {{protocol type with generic arguments can only be used as a generic constraint}}
159159

160160
func takesSequenceOfInt2(_: any Sequence<Int>) {}
161-
// expected-error@-1 {{protocol type with generic arguments can only be used as a generic constraint}}
162161

163162
func returnsSequenceOfInt2() -> any Sequence<Int> {}
164-
// expected-error@-1 {{protocol type with generic arguments can only be used as a generic constraint}}
165163

166164
func typeExpr() {
167165
_ = Sequence<Int>.self

0 commit comments

Comments
 (0)