-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix label_flag and label_setting to not have a dependency on the default #13372
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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
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
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.
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.
When is this true? It doesn't seem to be true at any call site and AFAIU in order to fix the associated bug, the
build_setting_default
attribute must not create any dependencies, andallowedFilesTypes()
/allowedRuleClasses()
only make sense if a dependency is created. Assert that it's not true instead? (either here or inBuildSetting
)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.
I changed this from
isLabelType()
to== LabelClass.DEPENDENCY
specifically because of the change toNODEP_LABEL
: with this change, the calls toallowedFileTypes()
andallowedRuleClasses()
were failing because they only accept real labels, not nodep labels.Sorry I didn't wait for your review, this is currently internal at cl/369288702.
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.
Let me rephrase this: when I look at the code,
RuleClass.getBuildSetting()
never returns aType
wheregetLabelClass()
would returnDEPENDENCY
. But then why is this branch here?In addition, if there was any case where that did return
DEPENDENCY
, that would trigger the bug you are fixing here, so why not assert the opposite?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.
Ah, now I see your point. This entire check should be removed, since it's not possible to trigger it.
Should I add a check in
BuildSetting.create()
to ensure that onlyNODEP_LABEL
andNODEP_LABEL_CLASS
are used? I will make changes in the internal version and test this.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.
I think a better approach is to assert
buildSetting.getType().getLabelClass() != LabelClass.DEPENDENCY
beacuse that says exactly what is needed: that the type shouldn't be one that creates a dependency.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.
But
allowedFileTypes
can only validly be called when the type isLabelClass.DEPENDENCY
(see the definitions). Since it is now not possible to have an attribute with that type, there's no valid way to call this.