Skip to content

Commit c7c152b

Browse files
committed
Downgrade more sendability errors involving metatypes to warnings
1 parent 95b18d3 commit c7c152b

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
@@ -6721,8 +6721,7 @@ static bool checkSendableInstanceStorage(
67216721
elementType, context,
67226722
/*inDerivedConformance*/Type(), element->getLoc(),
67236723
[&](Type type, DiagnosticBehavior behavior) {
6724-
auto preconcurrency =
6725-
context.preconcurrencyBehavior(type->getAnyNominal());
6724+
auto preconcurrency = context.preconcurrencyBehavior(type);
67266725
if (isImplicitSendableCheck(check)) {
67276726
// If this is for an externally-visible conformance, fail.
67286727
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)