-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Defining, parsing, and checking #[attribute]
s
#6986
Open
ironcev
wants to merge
18
commits into
master
Choose a base branch
from
ironcev/declarative-and-checked-annotations
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+8,771
−1,813
Conversation
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
CodSpeed Performance ReportMerging #6986 will not alter performanceComparing Summary
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
breaking
May cause existing user code to break. Requires a minor or major release.
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
compiler: parser
Everything to do with the parser
compiler
General compiler. Should eventually become more specific as the issue is triaged
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.
Description
This PR reimplements how
#[attribute]
s are parsed, defined, and checked. It fixes the following issues we had with attributes:For concrete examples of these issues, see the list of closed issues below.
The PR:
Attributes
.convert_parse_tree
. Note that this means that modules with attribute issues will now consistently not reach the type checking phase. This was previously the case for some of the issues with attributes where custom checks where done during the type checking phase. Move attribute checks to type checking phase #6987 proposes to move those checks after the tree conversion phase, allowing the continuation of compilation.AttributeKind::Unknow
to preserve unknown attributes in the typed tree.Doc
attribute.The PR also introduces a new pattern in emitting errors. The
attr_decls_to_attributes
function will always returnAttributes
even if they have errors, because:#[cfg]
attribute among those evaluates to false.For more details, see the comment on
attr_decls_to_attributes
andcfg_eval
.Closes #6880, #6913, #6914, #6915, #6916, #6917, #6918, #6931, #6981, #6983, #6984, #6985.
Breaking changes
Strictly seen, this PR can cause breaking changes, but only in the case of invalid existing attribute usage. We treat those breaking changes as bug fixes in the compiler and, thus, do not have them behind a feature flag.
E.g., this kind of code was possible before, but will now emit and error:
Checklist
Breaking*
orNew Feature
labels where relevant.