Skip to content
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 analyzer pushing SHADOWED_VARIABLE warning for members shadowed in subclass #98873

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

girdenis-p
Copy link
Contributor

@girdenis-p girdenis-p commented Nov 6, 2024

This fixes #74395. It does this by comparing the class which contains the shadowed member with the class containing the variable, and pushing the SHADOWED_VARIABLE warning only if the classes are the same, otherwise the SHADOWED_VARIABLE_BASE_CLASS warning is pushed.

Additionally, SHADOWED_VARIABLE_BASE_CLASS can now take an extra symbol which helps to specify the line for non native base class.

Comments and docs have been updated to highlight that these warnings are related to shadowed members in the concerning class instead of just shadowed variables.

@girdenis-p girdenis-p requested review from a team as code owners November 6, 2024 00:56
@dalexeev dalexeev added this to the 4.4 milestone Nov 6, 2024
@girdenis-p girdenis-p force-pushed the shadowed-variable-warning branch from aae9172 to d4881bd Compare November 6, 2024 13:41
Copy link
Member

@dalexeev dalexeev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. It would be great to check the grammar in documentation and warning messages.

…n subclasses

This fixes a bug in the analyzer where it did not push the SHADOWED_VARIABLE_BASE_CLASS
warning for members shadowed by variable in subclass. It does this by comparing the class
which contains the shadowed member with the class containing the variable, and pushing
SHADOWED_VARIABLE only if the classes are the same. Additionally, SHADOWED_VARIABLE_BASE_CLASS
can take an extra symbol which helps to specify the line for non native base class.
@girdenis-p girdenis-p force-pushed the shadowed-variable-warning branch from 8d0aee7 to 413490c Compare November 6, 2024 15:04
@akien-mga akien-mga changed the title Fix analyzer pushing SHADOWED_VARIABLE warning for members shadowed in subclass Fix analyzer pushing SHADOWED_VARIABLE warning for members shadowed in subclass Nov 7, 2024
@Repiteo Repiteo merged commit 9b23b20 into godotengine:master Nov 7, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Nov 7, 2024

Thanks! Congratulations on your first contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SHADOWED_VARIABLE warning is unclear for derived classes
5 participants