Skip to content

Commit e5c7d25

Browse files
committed
Serialization: Fix serializing normal conformance xrefs for tuple conformances
Fixes rdar://problem/113707902.
1 parent 1f23f7a commit e5c7d25

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ Serializer::writeASTBlockEntity(ProtocolConformance *conformance) {
17891789
Out, ScratchRecord,
17901790
abbrCode,
17911791
addDeclRef(normal->getProtocol()),
1792-
addDeclRef(normal->getType()->getAnyNominal()),
1792+
addDeclRef(normal->getDeclContext()->getSelfNominalTypeDecl()),
17931793
addContainingModuleRef(normal->getDeclContext(),
17941794
/*ignoreExport=*/true));
17951795
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
public struct G<T: Sendable> {
2+
}
3+
4+
public func makeG<T: Sendable>(_: T.Type) -> G<T> {
5+
return G<T>()
6+
}
7+
8+
@_transparent public func makeVoidG() -> G<Void> {
9+
return makeG(Void.self)
10+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module %S/Inputs/tuple_conformance_other.swift -emit-module-path %t/lib.swiftmodule -module-name lib
3+
// RUN: %target-swift-frontend -emit-sil %s -I %t | %FileCheck %s
4+
import lib
5+
6+
public func doStuff() {
7+
print(makeVoidG())
8+
}
9+
10+
// CHECK-LABEL: sil public_external [transparent] @$s3lib9makeVoidGAA1GVyytGyF : $@convention(thin) () -> G<()> {
11+
// CHECK: [[FN:%.*]] = function_ref @$s3lib5makeGyAA1GVyxGxms8SendableRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : Sendable> (@thick τ_0_0.Type) -> G<τ_0_0>
12+
// CHECK-NEXT: [[RESULT:%.*]] = apply [[FN]]<()>({{%.*}}) : $@convention(thin) <τ_0_0 where τ_0_0 : Sendable> (@thick τ_0_0.Type) -> G<τ_0_0>
13+
// CHECK-NEXT: return [[RESULT]] : $G<()>

0 commit comments

Comments
 (0)