File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -1751,6 +1751,10 @@ class AccessorConformanceInfo : public ConformanceInfo {
17511751#endif
17521752
17531753 auto typeWitness = Conformance.getTypeWitness (assocType);
1754+ if (langOpts.hasFeature (Feature::EmbeddedExistentials) &&
1755+ SILWT->isSpecialized ()) {
1756+ typeWitness = entry.getAssociatedTypeWitness ().Witness ;
1757+ }
17541758
17551759 if (IGM.Context .LangOpts .hasFeature (Feature::EmbeddedExistentials)) {
17561760 // In Embedded Swift associated type witness point to the metadata.
Original file line number Diff line number Diff line change @@ -302,6 +302,47 @@ func test13(_ p: any P4) {
302302 p. t. printit ( )
303303}
304304
305+ struct GenericConformer < T> : ValuePrinter {
306+ var t : T ?
307+ var l = ( 0 , 1 , 2 , 3 )
308+
309+ init ( _ t: T ) { self . t = t }
310+
311+ func printValue( ) {
312+ print ( " GenericConformer \( l. 0 ) \( l. 1 ) \( l. 2 ) \( l. 3 ) " )
313+ }
314+
315+ mutating func mutate( ) {
316+ l = ( 4 , 5 , 6 , 7 )
317+ }
318+ }
319+
320+ struct GenericConformerWithAssoc < T> : WithAssoc {
321+ var g : GenericConformer < T >
322+
323+ init ( _ g: T ) {
324+ self . g = GenericConformer ( g)
325+ }
326+
327+ func a( ) -> GenericConformer < T > {
328+ return g
329+ }
330+ }
331+
332+ func test14( _ p: any ValuePrinter ) {
333+ print ( " test any ValuePrinter " )
334+ p. printValue ( )
335+ var p2 = p
336+ p2. mutate ( )
337+ p2. printValue ( )
338+ }
339+
340+ func test15( _ p: any WithAssoc ) {
341+ print ( " test any WithAssoc " )
342+ let l = p. a ( )
343+ l. printValue ( )
344+ }
345+
305346@main
306347struct Main {
307348 static func main( ) {
@@ -423,5 +464,13 @@ struct Main {
423464 test13 ( P4Conformer ( ) )
424465// OUTPUT: test13
425466// OUTPUT: QConformer 3
467+ // OUTPUT-NOT: deinit
468+ test14 ( GenericConformer ( 1 ) )
469+ // OUTPUT: test any ValuePrinter
470+ // OUTPUT: GenericConformer 0 1 2 3
471+ // OUTPUT: GenericConformer 4 5 6 7
472+ test15 ( GenericConformerWithAssoc ( 1 ) )
473+ // OUTPUT: test any WithAssoc
474+ // OUTPUT: GenericConformer 0 1 2 3
426475 }
427476}
You can’t perform that action at this time.
0 commit comments