Skip to content

Commit c327081

Browse files
Isolated keyword should not be permitted in inheritance clause
1 parent e293876 commit c327081

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5393,8 +5393,8 @@ TypeResolver::resolveIsolatedTypeRepr(IsolatedTypeRepr *repr,
53935393
TypeResolutionOptions options) {
53945394
// isolated is only value for non-EnumCaseDecl parameters.
53955395
if ((!options.is(TypeResolverContext::FunctionInput) ||
5396-
options.hasBase(TypeResolverContext::EnumElementDecl)) &&
5397-
!options.is(TypeResolverContext::Inherited)) {
5396+
(options.hasBase(TypeResolverContext::EnumElementDecl) &&
5397+
!options.is(TypeResolverContext::Inherited)) || options.is(TypeResolverContext::Inherited))) {
53985398
diagnoseInvalid(
53995399
repr, repr->getSpecifierLoc(), diag::attr_only_on_parameters,
54005400
"isolated");

test/Concurrency/isolated_parameters.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,8 @@ struct WritableActorKeyPath<Root: Actor, Value>: Sendable {
343343
nonmutating set { setter(root, newValue) }
344344
}
345345
}
346+
347+
protocol P {}
348+
struct S: isolated P {} // expected-error {{'isolated' may only be used on parameters}}
349+
350+

0 commit comments

Comments
 (0)