|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | + |
| 3 | +// RUN: %target-build-swift -emit-executable %s -g -o %t/constrained_existentials -emit-module -Xfrontend -disable-availability-checking |
| 4 | +// RUN: sed -ne '/\/\/ *DEMANGLE: /s/\/\/ *DEMANGLE: *//p' < %s > %t/input |
| 5 | +// RUN: %lldb-moduleimport-test %t/constrained_existentials -type-from-mangled=%t/input | %FileCheck %s |
| 6 | + |
| 7 | +func blackHole(_: Any...) {} |
| 8 | + |
| 9 | +protocol BaseProto<A, B> { |
| 10 | + associatedtype A |
| 11 | + associatedtype B |
| 12 | +} |
| 13 | + |
| 14 | +protocol DerivedProto<A, B>: BaseProto {} |
| 15 | + |
| 16 | +protocol OtherProto {} |
| 17 | + |
| 18 | +struct S<A, B>: DerivedProto, OtherProto {} |
| 19 | + |
| 20 | +// We should lift the artificial ban on compositions involving constrained protocol types |
| 21 | +typealias BaseProtoIntStringAndOtherProto = BaseProto<Int, String> & OtherProto |
| 22 | + |
| 23 | +do { |
| 24 | + let e0: any BaseProto<Int, String> = S<Int, String>() |
| 25 | + let e1: any BaseProto<Int, String>.Type = S<Int, String>.self |
| 26 | + let e2: (any BaseProto<Int, String>).Type = (any BaseProto<Int, String>).self |
| 27 | + |
| 28 | + blackHole(e0, e1, e2) |
| 29 | +} |
| 30 | + |
| 31 | +// DEMANGLE: $s24constrained_existentials9BaseProto_pSi1AAaBPRts_SS1BADRtsXPD |
| 32 | +// DEMANGLE: $s24constrained_existentials9BaseProto_pSi1AAaBPRts_SS1BADRtsXPXmTD |
| 33 | +// DEMANGLE: $s24constrained_existentials9BaseProto_pSi1AAaBPRts_SS1BADRtsXPXMtD |
| 34 | + |
| 35 | +// CHECK: BaseProto<Int, String> |
| 36 | +// CHECK: @thick BaseProto<Int, String>.Type |
| 37 | +// CHECK: @thin BaseProto<Int, String>.Protocol |
| 38 | + |
| 39 | +do { |
| 40 | + let e0: any DerivedProto<Int, String> = S<Int, String>() |
| 41 | + let e1: any DerivedProto<Int, String>.Type = S<Int, String>.self |
| 42 | + let e2: (any DerivedProto<Int, String>).Type = (any DerivedProto<Int, String>).self |
| 43 | + |
| 44 | + blackHole(e0, e1, e2) |
| 45 | +} |
0 commit comments