Skip to content

Commit f0b7d2e

Browse files
Merge pull request #4702 from swiftwasm/release/5.7
[pull] swiftwasm-release/5.7 from release/5.7
2 parents 8d15f81 + c2e1a3e commit f0b7d2e

4 files changed

+70
-3
lines changed

lib/IRGen/Linking.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,9 +1158,12 @@ bool LinkEntity::isWeakImported(ModuleDecl *module) const {
11581158

11591159
case Kind::AssociatedConformanceDescriptor:
11601160
case Kind::DefaultAssociatedConformanceAccessor: {
1161-
// Associated conformance descriptors use the protocol as
1162-
// their declaration, but are weak linked if the associated
1163-
// type stored in extra storage area is weak linked.
1161+
// Associated conformance descriptors use the protocol as their declaration
1162+
// and are weak linked if either the protocol or the associated type stored
1163+
// in extra storage area is weak linked.
1164+
if (cast<ProtocolDecl>(getDecl())->isWeakImported(module))
1165+
return true;
1166+
11641167
auto assocConformance = getAssociatedConformance();
11651168
auto *depMemTy = assocConformance.first->castTo<DependentMemberType>();
11661169
return depMemTy->getAssocType()->isWeakImported(module);

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_through_generic.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
// REQUIRES: concurrency
88
// REQUIRES: distributed
99

10+
// FIXME: rdar://96520492 Test fails on specific config: Tools Opt+Assert, Stdlib Opt+DebInfo+Assert, iOS_arm64e
11+
// UNSUPPORTED: CPU=arm64e
12+
1013
// rdar://76038845
1114
// UNSUPPORTED: use_os_stdlib
1215
// UNSUPPORTED: back_deployment_runtime

test/Distributed/Runtime/distributed_actor_func_calls_remoteCall_through_generic_and_inner.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// UNSUPPORTED: use_os_stdlib
1212
// UNSUPPORTED: back_deployment_runtime
1313

14+
// FIXME: rdar://96520224 Test fails on specific config: Tools Opt+Assert, Stdlib Opt+DebInfo+Assert, iOS_arm64e
15+
// UNSUPPORTED: CPU=arm64e
16+
1417
// FIXME(distributed): Distributed actors currently have some issues on windows, isRemote always returns false. rdar://82593574
1518
// UNSUPPORTED: OS=windows-msvc
1619

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/Library.swiftmodule -parse-as-library %t/Library.swift -enable-library-evolution
5+
// RUN: %target-swift-frontend -primary-file %t/Client.swift -I %t -emit-ir | %FileCheck %s
6+
7+
// REQUIRES: OS=macosx
8+
9+
//--- Library.swift
10+
11+
public protocol P { }
12+
public protocol Q: P { }
13+
14+
public protocol StrongProtoWithAssoc {
15+
associatedtype Assoc: P
16+
}
17+
18+
public protocol StrongProtoWithWeakLinkedAssoc {
19+
@_weakLinked associatedtype Assoc: P
20+
}
21+
22+
@available(macOS 10.50, *)
23+
public protocol WeakProtoWithAssoc {
24+
associatedtype Assoc: P
25+
}
26+
27+
@available(macOS 10.50, *)
28+
public protocol WeakProtoWithStrongInheritedAssoc: StrongProtoWithAssoc where Self.Assoc: Q { }
29+
30+
31+
//--- Client.swift
32+
33+
import Library
34+
35+
struct ConformsToP: P { }
36+
struct ConformsToQ: Q { }
37+
38+
// CHECK: @"$s7Library20StrongProtoWithAssocP0E0AC_AA1PTn" = external global %swift.protocol_requirement, align 4
39+
struct ConformsToStrongProtoWithAssoc: StrongProtoWithAssoc {
40+
typealias Assoc = ConformsToP
41+
}
42+
43+
// CHECK: @"$s7Library30StrongProtoWithWeakLinkedAssocP0G0AC_AA1PTn" = extern_weak global %swift.protocol_requirement, align 4
44+
struct ConformsToStrongProtoWithWeakLinkedAssoc: StrongProtoWithWeakLinkedAssoc {
45+
typealias Assoc = ConformsToP
46+
}
47+
48+
// CHECK: @"$s7Library18WeakProtoWithAssocP0E0AC_AA1PTn" = extern_weak global %swift.protocol_requirement, align 4
49+
@available(macOS 10.50, *)
50+
struct ConformsToWeakProtoWithAssoc: WeakProtoWithAssoc {
51+
typealias Assoc = ConformsToP
52+
}
53+
54+
// CHECK: @"$s7Library33WeakProtoWithStrongInheritedAssocP0G0AA0ecdG0P_AA1QTn" = extern_weak global %swift.protocol_requirement, align 4
55+
@available(macOS 10.50, *)
56+
struct ConformsToWeakProtoWithStrongInheritedAssoc: WeakProtoWithStrongInheritedAssoc {
57+
typealias Assoc = ConformsToQ
58+
}

0 commit comments

Comments
 (0)