Skip to content

Commit bc1761a

Browse files
authored
Merge pull request #67876 from slavapestov/tuple-conformance-fixes
Tuple conformance fixes
2 parents 1ef4f80 + e5c7d25 commit bc1761a

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

lib/Sema/ResilienceDiagnostics.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ TypeChecker::diagnoseConformanceExportability(SourceLoc loc,
280280
if (!where.mustOnlyReferenceExportedDecls())
281281
return false;
282282

283+
// Skip the special Sendable and Copyable conformances we synthesized in
284+
// ASTContext::getBuiltinTupleDecl().
285+
if (ext->getParentModule()->isBuiltinModule())
286+
return false;
287+
283288
auto originKind = getDisallowedOriginKind(ext, where);
284289
if (originKind == DisallowedOriginKind::None)
285290
return false;

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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
public struct G<T: Sendable> {}
4+
5+
public func makeG() -> G<Void> {}
6+
7+
// No spurious warning about use of conformance from Builtin module
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)