Skip to content

Commit bcc7a5b

Browse files
committed
Add tests to ensure that we weak-link associated conformances introduced later
1 parent b901771 commit bcc7a5b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/IRGen/weak_import_associated_conformance_descriptor.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ public protocol StrongProtoWithWeakLinkedAssoc {
1919
@_weakLinked associatedtype Assoc: P
2020
}
2121

22+
public struct LibConformsToP: P { }
23+
24+
public protocol StrongProtoWithNewAssoc {
25+
@available(macOS 10.50, *)
26+
associatedtype NewerAssoc: P = LibConformsToP
27+
}
28+
2229
@available(macOS 10.50, *)
2330
public protocol WeakProtoWithAssoc {
2431
associatedtype Assoc: P
@@ -40,11 +47,18 @@ struct ConformsToStrongProtoWithAssoc: StrongProtoWithAssoc {
4047
typealias Assoc = ConformsToP
4148
}
4249

50+
4351
// CHECK: @"$s7Library30StrongProtoWithWeakLinkedAssocP0G0AC_AA1PTn" = extern_weak global %swift.protocol_requirement, align 4
4452
struct ConformsToStrongProtoWithWeakLinkedAssoc: StrongProtoWithWeakLinkedAssoc {
4553
typealias Assoc = ConformsToP
4654
}
4755

56+
// CHECK: @"$s7Library23StrongProtoWithNewAssocP05NewerF0AC_AA1PTn" = extern_weak global %swift.protocol_requirement, align 4
57+
// CHECK: @"$s10NewerAssoc7Library018StrongProtoWithNewB0PTl" = extern_weak global %swift.protocol_requirement, align 4
58+
struct ConformsToStrongProtoWithNewAssoc: StrongProtoWithNewAssoc {
59+
typealias NewAssoc = ConformsToP
60+
}
61+
4862
// CHECK: @"$s7Library18WeakProtoWithAssocP0E0AC_AA1PTn" = extern_weak global %swift.protocol_requirement, align 4
4963
@available(macOS 10.50, *)
5064
struct ConformsToWeakProtoWithAssoc: WeakProtoWithAssoc {

0 commit comments

Comments
 (0)