Skip to content

Commit 7befd1d

Browse files
jakemac53lrhn
authored andcommitted
Make it an error to generate macro applications that apply to previous phases (#3214)
Related to #1931 and #1908
1 parent 9ca38d2 commit 7befd1d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

working/macros/feature-specification.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -897,18 +897,19 @@ implement their own declarations (#1908).
897897

898898
#### Adding macro applications to new declarations
899899

900-
When creating [Code][] instances, a macro may generate code which includes
900+
When creating [DeclarationCode][] instances, a macro may generate code which includes
901901
macro applications. These macro applications must be from either the current
902902
phase or a later phase, but cannot be from previous phases.
903903

904-
If a macro application is added which implements an earlier phase, that phase
905-
is not ran. This should result in a warning if the macro does not also
906-
implement some phase that will be ran.
904+
It is an error for a macro application to be added which would have applied to
905+
its declaration in an earlier phase.
907906

908907
If a macro application is added which runs in the same phase as the current
909908
one, then it is immediately expanded after execution of the current macro,
910909
following the normal ordering rules.
911910

911+
[DeclarationCode]: https://github.com/dart-lang/sdk/blob/main/pkg/_fe_analyzer_shared/lib/src/macros/api/code.dart#L37
912+
912913
#### Ordering violations
913914

914915
Both of these mechanisms allow for normal macro ordering to be circumvented.

0 commit comments

Comments
 (0)