Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/Sema/TypeCheckType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5391,10 +5391,10 @@ TypeResolver::resolveOwnershipTypeRepr(OwnershipTypeRepr *repr,
NeverNullType
TypeResolver::resolveIsolatedTypeRepr(IsolatedTypeRepr *repr,
TypeResolutionOptions options) {
// isolated is only value for non-EnumCaseDecl parameters.
// isolated is only valid for non-EnumCaseDecl parameters.
if ((!options.is(TypeResolverContext::FunctionInput) ||
options.hasBase(TypeResolverContext::EnumElementDecl)) &&
!options.is(TypeResolverContext::Inherited)) {
(options.hasBase(TypeResolverContext::EnumElementDecl) &&
!options.is(TypeResolverContext::Inherited)) || options.is(TypeResolverContext::Inherited))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually need the inheritance check here? seems it was added here (or possibly here depending on your view of history), but wasn't present before. perhaps the other relevant changes from those PRs should be taken into account as well.

Copy link
Author

@AlexsanderDamaceno AlexsanderDamaceno Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks that this changes are related to related to use isolated in actors

diagnoseInvalid(
repr, repr->getSpecifierLoc(), diag::attr_only_on_parameters,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aside: this diagnostic no longer seems accurate since isolated is now valid on deinits.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will do a pr removing this

"isolated");
Expand Down
5 changes: 5 additions & 0 deletions test/Concurrency/isolated_parameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -343,3 +343,8 @@ struct WritableActorKeyPath<Root: Actor, Value>: Sendable {
nonmutating set { setter(root, newValue) }
}
}

protocol P {}
struct S: isolated P {} // expected-error {{'isolated' may only be used on parameters}}
Copy link
Contributor

@jamieQ jamieQ Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the referenced 'enum decl' case should probably also have a test (i didn't see any when searching for this error message).

edit: when testing it out, seems this will just crash the compiler:

enum E {
  case iso(isolated any Actor)
}

but i guess that's a separate bug i will file filed: #86007