-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Distributed] Remove diagnostic emitting from macro, rely on compiler
The macro cannot diagnose some situations, or rather, would diagnose too aggressively, because it cannot inspect the type declarations of all invokved types, and therefore we're unable to reliably report errors only when necessary. Originally I thought we don't want to emit macro code that "may fail to compile" but we don't really have a choice. This patch removes a manual diagnostic, and enables more correct code to properly use @resolvable protocols.
- Loading branch information
Showing
4 changed files
with
35 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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
25 changes: 25 additions & 0 deletions
25
...Distributed/Macros/distributed_macro_expansion_DistributedProtocol_expansion_errors.swift
This file contains 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,25 @@ | ||
// 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: not %target-swift-frontend -typecheck -disable-availability-checking -plugin-path %swift-plugin-dir -parse-as-library -I %t %S/../Inputs/FakeDistributedActorSystems.swift -dump-macro-expansions %s 2>&1 | %FileCheck %s | ||
|
||
import Distributed | ||
|
||
// These tests check the error output inside of a "bad" expansion; | ||
// | ||
// Since we cannot nicely diagnose these problems from the macro itself, | ||
// as it would need to inspect the type and its extensions and all involved | ||
// protocols., as at least | ||
|
||
// CHECK: macro expansion @Resolvable:1:[[COL:[0-9]+]]: error: distributed actor '$Fail' does not declare ActorSystem it can be used with | ||
@Resolvable | ||
protocol Fail: DistributedActor { | ||
distributed func method() -> String | ||
} |
This file contains 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