File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -288,11 +288,11 @@ class TypeResolutionOptions {
288
288
case Context::GenericRequirement:
289
289
return true ;
290
290
case Context::ExistentialConstraint:
291
+ case Context::MetatypeBase:
291
292
return opts.EnableParameterizedExistentialTypes ;
292
293
case Context::None:
293
294
case Context::TypeAliasDecl:
294
295
case Context::GenericTypeAliasDecl:
295
- case Context::MetatypeBase:
296
296
case Context::InExpression:
297
297
case Context::ExplicitCastExpr:
298
298
case Context::ForEachStmt:
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -enable-parameterized-existential-types
2
+ //
3
+ // FIXME: Merge this file with existential_metatypes.swift once -enable-parameterized-existential-types becomes the default
4
+
5
+ protocol P < T> {
6
+ associatedtype T
7
+ }
8
+
9
+ protocol Q < T> {
10
+ associatedtype T
11
+ }
12
+
13
+ protocol PP < U> : P < Self . U . T > {
14
+ associatedtype U : P < U >
15
+ }
16
+
17
+ var qp : ( any Q < Int > ) . Type
18
+ var pp : ( any P < Int > ) . Type = qp // expected-error{{cannot convert value of type '(any Q<Int>).Type' to specified type '(any P<Int>).Type'}}
19
+
20
+ var qt : any Q < Int > . Type
21
+ qt = qp // expected-error{{cannot assign value of type '(any Q<Int>).Type' to type 'any Q<Int>.Type'}}
22
+ qp = qt // expected-error{{cannot assign value of type 'any Q<Int>.Type' to type '(any Q<Int>).Type'}}
23
+ var pt : any P < Int > . Type = qt // expected-error{{cannot convert value of type 'any Q<Int>.Type' to specified type 'any P<Int>.Type'}}
24
+ pt = pp // expected-error{{cannot assign value of type '(any P<Int>).Type' to type 'any P<Int>.Type'}}
25
+ pp = pt // expected-error{{cannot assign value of type 'any P<Int>.Type' to type '(any P<Int>).Type'}}
26
+
27
+ var ppp : ( any PP < Int > ) . Type
28
+ pp = ppp // expected-error{{cannot assign value of type '(any PP<Int>).Type' to type '(any P<Int>).Type'}}
29
+
30
+ var ppt : any PP < Int > . Type
31
+ pt = ppt
You can’t perform that action at this time.
0 commit comments