Skip to content

Commit b02a1a6

Browse files
committed
Downgrade more sendability errors involving metatypes to warnings
(cherry picked from commit c7c152b)
1 parent b9ace6f commit b02a1a6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6731,8 +6731,7 @@ static bool checkSendableInstanceStorage(
67316731
elementType, context,
67326732
/*inDerivedConformance*/Type(), element->getLoc(),
67336733
[&](Type type, DiagnosticBehavior behavior) {
6734-
auto preconcurrency =
6735-
context.preconcurrencyBehavior(type->getAnyNominal());
6734+
auto preconcurrency = context.preconcurrencyBehavior(type);
67366735
if (isImplicitSendableCheck(check)) {
67376736
// If this is for an externally-visible conformance, fail.
67386737
if (check == SendableCheck::ImplicitForExternallyVisible) {

test/Concurrency/sendable_metatype_typecheck.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,11 @@ class Holder: @unchecked Sendable {
117117
2: String.self,
118118
]
119119
}
120+
121+
enum E: Sendable {
122+
case q(Q.Type, Int) // expected-warning{{associated value 'q' of 'Sendable'-conforming enum 'E' has non-sendable type 'any Q.Type'}}
123+
}
124+
125+
struct S: Sendable {
126+
var tuple: ([Q.Type], Int) // expected-warning{{stored property 'tuple' of 'Sendable'-conforming struct 'S' has non-sendable type '([any Q.Type], Int)'}}
127+
}

0 commit comments

Comments
 (0)