Skip to content

Commit ab4ff13

Browse files
committed
[Type System] Enable explicit existential types.
1 parent 79e6deb commit ab4ff13

File tree

10 files changed

+72
-72
lines changed

10 files changed

+72
-72
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ namespace swift {
315315

316316
/// Enable support for explicit existential types via the \c any
317317
/// keyword.
318-
bool EnableExplicitExistentialTypes = false;
318+
bool EnableExplicitExistentialTypes = true;
319319

320320
/// Enable experimental flow-sensitive concurrent captures.
321321
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;

lib/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5656
/// describe what change you made. The content of this comment isn't important;
5757
/// it just ensures a conflict if two people change the module format.
5858
/// Don't worry about adhering to the 80-column limit for this line.
59-
const uint16_t SWIFTMODULE_VERSION_MINOR = 652; // @main cleanup
59+
const uint16_t SWIFTMODULE_VERSION_MINOR = 653; // enable explicit existentials
6060

6161
/// A standard hash seed used for all string hashes in a serialized module.
6262
///

test/Generics/function_defs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func min<T : MethodLessComparable>(_ x: T, y: T) -> T {
3434
//===----------------------------------------------------------------------===//
3535

3636
func existential<T : EqualComparable, U : EqualComparable>(_ t1: T, t2: T, u: U) {
37-
var eqComp : EqualComparable = t1 // Ok
37+
var eqComp : EqualComparable = t1 // expected-warning {{protocol 'EqualComparable' as a type must be explicitly marked as 'any'}}
3838
eqComp = u
3939
if t1.isEqual(eqComp) {} // expected-error{{cannot convert value of type 'EqualComparable' to expected argument type 'T'}}
4040
if eqComp.isEqual(t2) {} // expected-error{{member 'isEqual' cannot be used on value of protocol type 'EqualComparable'; use a generic constraint instead}}
@@ -49,11 +49,11 @@ func otherExistential<T : EqualComparable>(_ t1: T) {
4949
otherEqComp = t1 // expected-error{{value of type 'T' does not conform to 'OtherEqualComparable' in assignment}}
5050
_ = otherEqComp
5151

52-
var otherEqComp2 : OtherEqualComparable // Ok
52+
var otherEqComp2 : any OtherEqualComparable // Ok
5353
otherEqComp2 = t1 // expected-error{{value of type 'T' does not conform to 'OtherEqualComparable' in assignment}}
5454
_ = otherEqComp2
5555

56-
_ = t1 as EqualComparable & OtherEqualComparable // expected-error{{value of type 'T' does not conform to 'EqualComparable & OtherEqualComparable' in coercion}}
56+
_ = t1 as any EqualComparable & OtherEqualComparable // expected-error{{value of type 'T' does not conform to 'EqualComparable & OtherEqualComparable' in coercion}}
5757
}
5858

5959
//===----------------------------------------------------------------------===//

test/decl/nested/protocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protocol OuterProtocol {
3131
struct ConformsToOuterProtocol : OuterProtocol {
3232
typealias Hen = Int
3333

34-
func f() { let _ = InnerProtocol.self } // Ok
34+
func f() { let _ = InnerProtocol.self } // expected-warning {{protocol 'InnerProtocol' as a type must be explicitly marked as 'any'}}
3535
}
3636

3737
protocol Racoon {

test/decl/protocol/conforms/inherited.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ class B : A {
167167
}
168168

169169
func testB(_ b: B) {
170-
var _: P1 = b
171-
var _: P4 = b
170+
var _: P1 = b // expected-warning {{protocol 'P1' as a type must be explicitly marked as 'any'}}
171+
var _: P4 = b // expected-warning {{protocol 'P4' as a type must be explicitly marked as 'any'}}
172172
var _: P5 = b
173173
var _: P6 = b
174-
var _: P7 = b
174+
var _: P7 = b // expected-warning {{protocol 'P7' as a type must be explicitly marked as 'any'}}
175175
var _: P8 = b
176-
var _: P9 = b
176+
var _: P9 = b // expected-warning {{protocol 'P9' as a type must be explicitly marked as 'any'}}
177177
}
178178

179179
// Class A5 conforms to P5 in an inheritable manner.

test/decl/protocol/protocols.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ struct Circle {
119119
func testCircular(_ circle: Circle) {
120120
// FIXME: It would be nice if this failure were suppressed because the protocols
121121
// have circular definitions.
122-
_ = circle as CircleStart // expected-error{{value of type 'Circle' does not conform to 'CircleStart' in coercion}}
122+
_ = circle as any CircleStart // expected-error{{value of type 'Circle' does not conform to 'CircleStart' in coercion}}
123123
}
124124

125125
// <rdar://problem/14750346>
@@ -439,18 +439,18 @@ func g<T : C2>(_ x : T) {
439439

440440
class C3 : P1 {} // expected-error{{type 'C3' does not conform to protocol 'P1'}}
441441
func h<T : C3>(_ x : T) {
442-
_ = x as P1
442+
_ = x as any P1
443443
}
444444
func i<T : C3>(_ x : T?) -> Bool {
445-
return x is P1
445+
return x is any P1
446446
// FIXME: Bogus diagnostic. See SR-11920.
447447
// expected-warning@-2 {{checking a value with optional type 'T?' against dynamic type 'P1' succeeds whenever the value is non-nil; did you mean to use '!= nil'?}}
448448
}
449449
func j(_ x : C1) -> Bool {
450-
return x is P1
450+
return x is P1 // expected-warning {{protocol 'P1' as a type must be explicitly marked as 'any'}}
451451
}
452452
func k(_ x : C1?) -> Bool {
453-
return x is P1
453+
return x is any P1
454454
}
455455

456456

test/decl/protocol/protocols_with_self_or_assoc_reqs.swift

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protocol P1 {
5757
func invariantSelf7(_: (G<Self>) -> Void)
5858
func invariantSelf8(_: G<(Self) -> Void>)
5959
func invariantSelf9(_: G<() -> Self>)
60-
func invariantSelf10(_: P1 & C<Self>)
60+
func invariantSelf10(_: any P1 & C<Self>)
6161
func invariantSelf11() -> G<Self>.InnerG<Void>
6262
func invariantAssoc1(_: inout Q)
6363
func invariantAssoc2(_: (inout Q) -> Void)
@@ -68,7 +68,7 @@ protocol P1 {
6868
func invariantAssoc7(_: (G<Q>) -> Void)
6969
func invariantAssoc8(_: G<(Q) -> Void>)
7070
func invariantAssoc9(_: G<() -> Q>)
71-
func invariantAssoc10(_: P1 & C<Q>)
71+
func invariantAssoc10(_: any P1 & C<Q>)
7272
func invariantAssoc11() -> G<Q>.InnerG<Void>
7373

7474
// Properties
@@ -117,7 +117,7 @@ protocol P1 {
117117
var invariantSelfProp7: ((G<Self>) -> Void) -> Void { get }
118118
var invariantSelfProp8: (G<(Self) -> Void>) -> Void { get }
119119
var invariantSelfProp9: (G<() -> Self>) -> Void { get }
120-
var invariantSelfProp10: (P1 & C<Self>) -> Void { get }
120+
var invariantSelfProp10: (any P1 & C<Self>) -> Void { get }
121121
var invariantSelfProp11: G<Self>.InnerG<Void> { get }
122122
var invariantAssocProp1: (inout Q) -> Void { get }
123123
var invariantAssocProp2: ((inout Q) -> Void) -> Void { get }
@@ -128,7 +128,7 @@ protocol P1 {
128128
var invariantAssocProp7: ((G<Q>) -> Void) { get }
129129
var invariantAssocProp8: (G<(Q) -> Void>) { get }
130130
var invariantAssocProp9: (G<() -> Q>) -> Void { get }
131-
var invariantAssocProp10: (P1 & C<Q>) -> Void { get }
131+
var invariantAssocProp10: (any P1 & C<Q>) -> Void { get }
132132
var invariantAssocProp11: G<Q>.InnerG<Void> { get }
133133

134134
// Subscripts
@@ -172,15 +172,15 @@ protocol P1 {
172172
subscript(invariantSelfSubscript4 _: (G<Self>) -> Void) -> Void { get }
173173
subscript(invariantSelfSubscript5 _: G<(Self) -> Void>) -> Void { get }
174174
subscript(invariantSelfSubscript6 _: G<() -> Self>) -> Void { get }
175-
subscript(invariantSelfSubscript7 _: P1 & C<Self>) -> Void { get }
175+
subscript(invariantSelfSubscript7 _: any P1 & C<Self>) -> Void { get }
176176
subscript(invariantSelfSubscript8 _: Void) -> G<Self>.InnerG<Void> { get }
177177
subscript(invariantAssocSubscript1 _: G<Q>) -> Void { get }
178178
subscript(invariantAssocSubscript2 _: Void) -> G<Q> { get }
179179
subscript(invariantAssocSubscript3 _: Void) -> G<Q>.Inner { get }
180180
subscript(invariantAssocSubscript4 _: (G<Q>) -> Void) -> Void { get }
181181
subscript(invariantAssocSubscript5 _: G<(Q) -> Void>) -> Void { get }
182182
subscript(invariantAssocSubscript6 _: G<() -> Q>) -> Void { get }
183-
subscript(invariantAssocSubscript7 _: P1 & C<Q>) -> Void { get }
183+
subscript(invariantAssocSubscript7 _: any P1 & C<Q>) -> Void { get }
184184
subscript(invariantAssocSubscript8 _: Void) -> G<Q>.InnerG<Void> { get }
185185
}
186186
@available(macOS 10.15, *)
@@ -191,40 +191,40 @@ extension P1 {
191191
}
192192

193193
do {
194-
func testP1(arg: P1) {
194+
func testP1(arg: any P1) {
195195
_ = arg.covariantSelfSimple() // ok
196-
let _: P1 = arg.covariantSelfSimple() // ok
196+
let _: any P1 = arg.covariantSelfSimple() // ok
197197
_ = arg.covariantSelfComplex({ _ in }, { _ in }, { _ in }, { _ in }) // ok
198-
let _: [String : () -> (P1, P1)] = arg.covariantSelfComplex(
199-
{ (x: P1) in },
200-
{ (x: P1?) in },
201-
{ (x: Array<P1>) in },
202-
{ (x: Array<Array<P1>?>) in }
198+
let _: [String : () -> (any P1, any P1)] = arg.covariantSelfComplex(
199+
{ (x: any P1) in },
200+
{ (x: (any P1)?) in },
201+
{ (x: Array<any P1>) in },
202+
{ (x: Array<Array<any P1>?>) in }
203203
) // ok
204204
arg.covariantAssocSimple // expected-error {{member 'covariantAssocSimple' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
205205
arg.covariantAssocComplex({ _ in }, { _ in }, { _ in }, { _ in }) // expected-error {{member 'covariantAssocComplex' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
206206
// FIXME: expected-error@-1 {{unable to infer type of a closure parameter '_' in the current context}}
207207

208208
_ = arg.covariantSelfPropSimple // ok
209-
let _: P1 = arg.covariantSelfPropSimple // ok
209+
let _: any P1 = arg.covariantSelfPropSimple // ok
210210
_ = arg.covariantSelfPropComplex // ok
211211
let _: (
212-
_: (P1) -> Void,
213-
_: (P1?) -> Void,
214-
_: (Array<P1>) -> Void,
215-
_: (Array<Array<P1>?>) -> Void
216-
) -> [String : () -> (P1, P1)] = arg.covariantSelfPropComplex // ok
212+
_: (any P1) -> Void,
213+
_: ((any P1)?) -> Void,
214+
_: (Array<any P1>) -> Void,
215+
_: (Array<Array<any P1>?>) -> Void
216+
) -> [String : () -> (any P1, any P1)] = arg.covariantSelfPropComplex // ok
217217
arg.covariantAssocPropSimple // expected-error {{member 'covariantAssocPropSimple' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
218218
arg.covariantAssocPropComplex // expected-error {{member 'covariantAssocPropComplex' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
219219

220220
_ = arg[covariantSelfSubscriptSimple: ()] // ok
221-
let _: P1 = arg[covariantSelfSubscriptSimple: ()] // ok
221+
let _: any P1 = arg[covariantSelfSubscriptSimple: ()] // ok
222222
_ = arg[covariantSelfSubscriptComplex: { _ in }, { _ in }, { _ in }, { _ in }] // ok
223-
let _: [String : () -> (P1, P1)] = arg[
224-
covariantSelfSubscriptComplex: { (x: P1) in },
225-
{ (x: P1?) in },
226-
{ (x: Array<P1>) in },
227-
{ (x: Array<Array<P1>?>) in }
223+
let _: [String : () -> (any P1, any P1)] = arg[
224+
covariantSelfSubscriptComplex: { (x: any P1) in },
225+
{ (x: (any P1)?) in },
226+
{ (x: Array<any P1>) in },
227+
{ (x: Array<Array<any P1>?>) in }
228228
] // ok
229229
arg[covariantAssocSubscriptSimple: ()] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
230230
arg[covariantAssocSubscriptComplex: { _ in }, { _ in }, { _ in }, { _ in }] // expected-error {{member 'subscript' cannot be used on value of protocol type 'P1'; use a generic constraint instead}}
@@ -444,15 +444,15 @@ protocol P1_TypeMemberOnInstanceAndViceVersa {
444444
do {
445445
// Test that invalid reference errors prevail over unsupported existential
446446
// member accesses.
447-
func test(protoMeta: P1_TypeMemberOnInstanceAndViceVersa.Protocol,
448-
existMeta: P1_TypeMemberOnInstanceAndViceVersa.Type,
449-
instance: P1_TypeMemberOnInstanceAndViceVersa) {
447+
func test(protoMeta: (any P1_TypeMemberOnInstanceAndViceVersa).Type,
448+
existMeta: any P1_TypeMemberOnInstanceAndViceVersa.Type,
449+
instance: any P1_TypeMemberOnInstanceAndViceVersa) {
450450
// P1_TypeMemberOnInstanceAndViceVersa.Protocol
451-
protoMeta.static_invariantSelfMethod() // expected-error {{static member 'static_invariantSelfMethod' cannot be used on protocol metatype 'P1_TypeMemberOnInstanceAndViceVersa.Protocol'}}
452-
protoMeta.static_invariantSelfProp // expected-error {{static member 'static_invariantSelfProp' cannot be used on protocol metatype 'P1_TypeMemberOnInstanceAndViceVersa.Protocol'}}
453-
protoMeta[static_invariantSelfSubscript: ()] // expected-error {{static member 'subscript' cannot be used on protocol metatype 'P1_TypeMemberOnInstanceAndViceVersa.Protocol'}}
451+
protoMeta.static_invariantSelfMethod() // expected-error {{static member 'static_invariantSelfMethod' cannot be used on protocol metatype '(P1_TypeMemberOnInstanceAndViceVersa).Protocol'}}
452+
protoMeta.static_invariantSelfProp // expected-error {{static member 'static_invariantSelfProp' cannot be used on protocol metatype '(P1_TypeMemberOnInstanceAndViceVersa).Protocol'}}
453+
protoMeta[static_invariantSelfSubscript: ()] // expected-error {{static member 'subscript' cannot be used on protocol metatype '(P1_TypeMemberOnInstanceAndViceVersa).Protocol'}}
454454
_ = protoMeta.covariantSelfMethod // ok
455-
protoMeta.invariantSelfMethod // expected-error {{member 'invariantSelfMethod' cannot be used on value of protocol type 'P1_TypeMemberOnInstanceAndViceVersa.Protocol'; use a generic constraint instead}}
455+
protoMeta.invariantSelfMethod // expected-error {{member 'invariantSelfMethod' cannot be used on value of protocol type '(P1_TypeMemberOnInstanceAndViceVersa).Protocol'; use a generic constraint instead}}
456456
protoMeta.invariantSelfProp // expected-error {{instance member 'invariantSelfProp' cannot be used on type 'P1_TypeMemberOnInstanceAndViceVersa'}}
457457
protoMeta[invariantSelfSubscript: ()] // expected-error {{instance member 'subscript' cannot be used on type 'P1_TypeMemberOnInstanceAndViceVersa'}}
458458

@@ -481,7 +481,7 @@ protocol P2 {
481481

482482
var prop: Self { get set }
483483
}
484-
func takesP2(p2: P2) {
484+
func takesP2(p2: any P2) {
485485
_ = p2[]
486486
// expected-error@-1{{member 'subscript' cannot be used on value of protocol type 'P2'; use a generic constraint instead}}
487487
_ = p2.prop
@@ -500,7 +500,7 @@ protocol MiscTestsProto {
500500
subscript(intToInt _: Int) -> Int { get }
501501
}
502502
do {
503-
func miscTests(_ arg: MiscTestsProto) { // ok
503+
func miscTests(_ arg: any MiscTestsProto) { // ok
504504
arg.runce(5)
505505

506506
do {
@@ -515,7 +515,7 @@ do {
515515
_ = arg[intToAssoc: 17] // expected-error{{member 'subscript' cannot be used on value of protocol type 'MiscTestsProto'; use a generic constraint instead}}
516516
}
517517

518-
func existentialSequence(_ e: Sequence) {
518+
func existentialSequence(_ e: any Sequence) {
519519
var x = e.makeIterator() // expected-error{{member 'makeIterator' cannot be used on value of protocol type 'Sequence'; use a generic constraint instead}}
520520
x.next()
521521
x.nonexistent()

test/decl/protocol/recursive_requirement.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protocol AsExistentialB {
9191
}
9292

9393
protocol AsExistentialAssocTypeA {
94-
var delegate : AsExistentialAssocTypeB? { get }
94+
var delegate : AsExistentialAssocTypeB? { get } // expected-warning {{protocol 'AsExistentialAssocTypeB' as a type must be explicitly marked as 'any'}}
9595
}
9696
protocol AsExistentialAssocTypeB {
9797
func aMethod(_ object : AsExistentialAssocTypeA)
@@ -103,7 +103,7 @@ protocol AsExistentialAssocTypeAgainA {
103103
associatedtype Bar
104104
}
105105
protocol AsExistentialAssocTypeAgainB {
106-
func aMethod(_ object : AsExistentialAssocTypeAgainA)
106+
func aMethod(_ object : AsExistentialAssocTypeAgainA) // expected-warning {{protocol 'AsExistentialAssocTypeAgainA' as a type must be explicitly marked as 'any'}}
107107
}
108108

109109
// SR-547

test/stmt/foreach.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func testOptionalSequence() {
176176
}
177177

178178
// FIXME: Should this be allowed?
179-
func testExistentialSequence(s: Sequence) {
179+
func testExistentialSequence(s: any Sequence) {
180180
for x in s { // expected-error {{protocol 'Sequence' as a type cannot conform to the protocol itself}} expected-note {{only concrete types such as structs, enums and classes can conform to protocols}}
181181
_ = x
182182
}

test/type/protocol_types.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
protocol HasSelfRequirements {
44
func foo(_ x: Self)
55

6-
func returnsOwnProtocol() -> HasSelfRequirements
6+
func returnsOwnProtocol() -> HasSelfRequirements // expected-warning {{protocol 'HasSelfRequirements' as a type must be explicitly marked as 'any'}}
77
}
88
protocol Bar {
99
// init() methods should not prevent use as an existential.
@@ -36,10 +36,10 @@ func useCompoAsWhereRequirement<T>(_ x: T) where T: HasSelfRequirements & Bar {}
3636
func useCompoAliasAsWhereRequirement<T>(_ x: T) where T: Compo {}
3737
func useNestedCompoAliasAsWhereRequirement<T>(_ x: T) where T: CompoAssocType.Compo {}
3838

39-
func useAsType(_: HasSelfRequirements,
40-
_: HasSelfRequirements & Bar,
41-
_: Compo,
42-
_: CompoAssocType.Compo) { }
39+
func useAsType(_: any HasSelfRequirements,
40+
_: any HasSelfRequirements & Bar,
41+
_: any Compo,
42+
_: any CompoAssocType.Compo) { }
4343

4444
struct TypeRequirement<T: HasSelfRequirements> {}
4545
struct CompoTypeRequirement<T: HasSelfRequirements & Bar> {}
@@ -74,7 +74,7 @@ do {
7474

7575
func checkIt(_ js: Any) throws {
7676
switch js {
77-
case let dbl as HasAssoc:
77+
case let dbl as HasAssoc: // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
7878
throw MyError.bad(dbl)
7979

8080
default:
@@ -83,27 +83,27 @@ do {
8383
}
8484
}
8585

86-
func testHasAssoc(_ x: Any, _: HasAssoc) {
87-
if let p = x as? HasAssoc {
86+
func testHasAssoc(_ x: Any, _: HasAssoc) { // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
87+
if let p = x as? any HasAssoc {
8888
p.foo() // don't crash here.
8989
}
9090

9191
struct ConformingType : HasAssoc {
9292
typealias Assoc = Int
9393
func foo() {}
9494

95-
func method() -> HasAssoc {}
95+
func method() -> HasAssoc {} // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
9696
}
9797
}
9898

9999
// SR-38
100-
var b: HasAssoc
100+
var b: HasAssoc // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
101101

102102
// Further generic constraint error testing - typealias used inside statements
103103
protocol P {}
104104
typealias MoreHasAssoc = HasAssoc & P
105105
func testHasMoreAssoc(_ x: Any) {
106-
if let p = x as? MoreHasAssoc {
106+
if let p = x as? any MoreHasAssoc {
107107
p.foo() // don't crash here.
108108
}
109109
}
@@ -118,34 +118,34 @@ typealias X = Struct1<Pub & Bar>
118118
_ = Struct1<Pub & Bar>.self
119119

120120
typealias AliasWhere<T> = T
121-
where T : HasAssoc, T.Assoc == HasAssoc
121+
where T : HasAssoc, T.Assoc == HasAssoc // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
122122

123123
struct StructWhere<T>
124124
where T : HasAssoc,
125-
T.Assoc == HasAssoc {}
125+
T.Assoc == any HasAssoc {}
126126

127-
protocol ProtocolWhere where T == HasAssoc {
127+
protocol ProtocolWhere where T == HasAssoc { // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
128128
associatedtype T
129129

130130
associatedtype U : HasAssoc
131-
where U.Assoc == HasAssoc
131+
where U.Assoc == any HasAssoc
132132
}
133133

134-
extension HasAssoc where Assoc == HasAssoc {}
134+
extension HasAssoc where Assoc == HasAssoc {} // expected-warning {{protocol 'HasAssoc' as a type must be explicitly marked as 'any'}}
135135

136136
func FunctionWhere<T>(_: T)
137137
where T : HasAssoc,
138-
T.Assoc == HasAssoc {}
138+
T.Assoc == any HasAssoc {}
139139

140140
struct SubscriptWhere {
141141
subscript<T>(_: T) -> Int
142142
where T : HasAssoc,
143-
T.Assoc == HasAssoc {
143+
T.Assoc == any HasAssoc {
144144
get {}
145145
set {}
146146
}
147147
}
148148

149149
struct OuterGeneric<T> {
150-
func contextuallyGenericMethod() where T == HasAssoc {}
150+
func contextuallyGenericMethod() where T == any HasAssoc {}
151151
}

0 commit comments

Comments
 (0)