@@ -245,11 +245,18 @@ struct ConformsToP1: P1 { }
245
245
struct ConformsToP2 : P2 { }
246
246
struct ConformsToP3 : P3 { }
247
247
248
+ struct ContextualWhere1 < T> {
249
+ class Nested1 where T: P1 { }
250
+ struct Nested2 where T == Int { }
251
+ }
252
+
248
253
DemangleToMetadataTests . test ( " protocol conformance requirements " ) {
249
254
expectEqual ( CG4 < ConformsToP1 , ConformsToP2 > . self,
250
255
_typeByName ( " 4main3CG4CyAA12ConformsToP1VAA12ConformsToP2VG " ) !)
251
256
expectEqual ( CG4< ConformsToP1, ConformsToP2> . InnerGeneric< ConformsToP3> . self ,
252
257
_typeByName ( " 4main3CG4C12InnerGenericVyAA12ConformsToP1VAA12ConformsToP2V_AA12ConformsToP3VG " ) !)
258
+ expectEqual ( ContextualWhere1 < ConformsToP1 > . Nested1. self,
259
+ _typeByName ( " 4main16ContextualWhere1V7Nested1CyAA12ConformsToP1V_G " ) !)
253
260
254
261
// Failure cases: failed conformance requirements.
255
262
expectNil ( _typeByName ( " 4main3CG4CyAA12ConformsToP1VAA12ConformsToP1VG " ) )
@@ -274,9 +281,16 @@ struct ConformsToP4c : P4 {
274
281
typealias Assoc2 = ConformsToP2
275
282
}
276
283
284
+ struct ContextualWhere2 < U: P4 > {
285
+ struct Nested1 where U. Assoc1: P1 , U. Assoc2: P2 { }
286
+ enum Nested2 where U. Assoc1 == U . Assoc2 { }
287
+ }
288
+
277
289
DemangleToMetadataTests . test ( " associated type conformance requirements " ) {
278
290
expectEqual ( SG5< ConformsToP4a> . self ,
279
291
_typeByName ( " 4main3SG5VyAA13ConformsToP4aVG " ) !)
292
+ expectEqual ( ContextualWhere2 < ConformsToP4a > . Nested1. self,
293
+ _typeByName ( " 4main16ContextualWhere2V7Nested1VyAA13ConformsToP4aV_G " ) !)
280
294
281
295
// Failure cases: failed conformance requirements.
282
296
expectNil ( _typeByName ( " 4main3SG5VyAA13ConformsToP4bVG " ) )
@@ -297,12 +311,16 @@ DemangleToMetadataTests.test("same-type requirements") {
297
311
// Concrete type.
298
312
expectEqual ( SG7< S> . self ,
299
313
_typeByName ( " 4main3SG7VyAA1SVG " ) !)
314
+ expectEqual ( ContextualWhere1 < Int > . Nested2. self,
315
+ _typeByName ( " 4main16ContextualWhere1V7Nested2VySi_G " ) !)
300
316
301
317
// Other associated type.
302
318
expectEqual ( SG6< ConformsToP4b> . self ,
303
319
_typeByName ( " 4main3SG6VyAA13ConformsToP4bVG " ) !)
304
320
expectEqual ( SG6< ConformsToP4c> . self ,
305
321
_typeByName ( " 4main3SG6VyAA13ConformsToP4cVG " ) !)
322
+ expectEqual ( ContextualWhere2 < ConformsToP4b > . Nested2. self,
323
+ _typeByName ( " 4main16ContextualWhere2V7Nested2OyAA13ConformsToP4bV_G " ) !)
306
324
307
325
// Structural type.
308
326
expectEqual ( SG8< ConformsToP4d> . self ,
0 commit comments