-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Distributed][Macro] Handle more cases in distributed protocol macro #72177
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
001e802
[Distributed][Macro] handle same type requirement
ktoso f6956b4
[DistributedProtocolMacro] ban attaching to wrong decl kind
ktoso 6671267
[DistributedProtocolMacro] Correct handling empty protocols
ktoso d6a29ed
[DistributedProtocolMacro] Properly handle same/inherit requirement c…
ktoso fe37e16
[DistributedMacro] add test for missing serialization requirement on …
ktoso 118f924
[DistributedMacros] Further edge-case handling cleanups
ktoso f7b27ec
[DistributedMacros] handle access control on generated code
ktoso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/Distributed/Macros/distributed_macro_expansion_DistributedProtocol_errors.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// REQUIRES: swift_swift_parser, asserts | ||
// | ||
// UNSUPPORTED: back_deploy_concurrency | ||
// REQUIRES: concurrency | ||
// REQUIRES: distributed | ||
// | ||
// RUN: %empty-directory(%t) | ||
// RUN: %empty-directory(%t-scratch) | ||
|
||
// RUN: %target-swift-frontend-emit-module -emit-module-path %t/FakeDistributedActorSystems.swiftmodule -module-name FakeDistributedActorSystems -disable-availability-checking %S/../Inputs/FakeDistributedActorSystems.swift | ||
// RUN: %target-swift-frontend -typecheck -verify -disable-availability-checking -plugin-path %swift-plugin-dir -parse-as-library -I %t %S/../Inputs/FakeDistributedActorSystems.swift -dump-macro-expansions %s 2>&1 | ||
|
||
import Distributed | ||
|
||
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'struct' (from macro '_DistributedProtocol')}} | ||
struct Struct {} | ||
|
||
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'class' (from macro '_DistributedProtocol')}} | ||
class Clazz {} | ||
|
||
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'actor' (from macro '_DistributedProtocol')}} | ||
actor Act {} | ||
|
||
@_DistributedProtocol // expected-error{{'@DistributedProtocol' can only be applied to 'protocol', but was attached to 'actor' (from macro '_DistributedProtocol')}} | ||
distributed actor Caplin { | ||
typealias ActorSystem = FakeActorSystem | ||
} | ||
|
||
@_DistributedProtocol // expected-error{{Distributed protocol must declare actor system with SerializationRequirement}} | ||
protocol Fail: DistributedActor { | ||
distributed func method() -> String | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.