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

GDScript: Do not produce UNUSED_SIGNAL warning for common implicit uses #89675

Merged

Conversation

dalexeev
Copy link
Member

@dalexeev dalexeev commented Mar 19, 2024

In 4.x, signals are first class values, but sometimes people use the old API and implicitly reference signals via strings.

With this PR the UNUSED_SIGNAL warning is not produced in the following cases:

  • Signal(self, <constant signal name>);
  • emit_signal(), connect(), and disconnect() with constant signal name.

@dalexeev dalexeev added this to the 4.3 milestone Mar 19, 2024
@dalexeev dalexeev requested a review from a team as a code owner March 19, 2024 12:09
@dalexeev dalexeev force-pushed the gds-correct-unused-signal-warning branch from 9340a2b to d1e2afa Compare March 19, 2024 14:43
Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

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

Discussed in the GDScript meeting. This warrants a discussion about what the UNUSED_SIGNAL warning is about. Is it only linked to emitting the signal vs connecting/disconnecting from it.

@dalexeev dalexeev requested a review from vnen April 23, 2024 14:36
@dalexeev dalexeev modified the milestones: 4.3, 4.4 Jul 24, 2024
@dalexeev dalexeev added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Jul 24, 2024
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Seems good to me. I confirm it fixes two false positives of this warning in gdquest-demos/godot-4-3d-third-person-controller#41 (superseded that PR).

I still have doubts on whether this warning is worth keeping giving its (apparently unsolvable) limitations, but I see no harm in doing this improvement for now to solve some known false positives.

@akien-mga akien-mga merged commit d3be91e into godotengine:master Sep 5, 2024
16 checks passed
@dalexeev dalexeev deleted the gds-correct-unused-signal-warning branch September 5, 2024 17:50
@akien-mga
Copy link
Member

Cherry-picked for 4.3.1.

@akien-mga akien-mga removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 16, 2024
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.

UNUSED_SIGNAL warning if signal is only used via emit_signal()
4 participants