-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Isolated keyword should not be permitted in inheritance clause #86001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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))) { | ||
| diagnoseInvalid( | ||
| repr, repr->getSpecifierLoc(), diag::attr_only_on_parameters, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aside: this diagnostic no longer seems accurate since
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, will do a pr removing this |
||
| "isolated"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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}} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
|
|
||
There was a problem hiding this comment.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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