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 symbol lookup misidentifying class constants #101777

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PopClom
Copy link

@PopClom PopClom commented Jan 18, 2025

My attempt to fix #97988.

The issue was caused by GDScriptLanguage::lookup_code checking base class constants and enums without considering the context. I added a condition to ensure this check only runs when the lookup context is COMPLETION_IDENTIFIER, preventing incorrect symbol resolution in other cases.

@PopClom PopClom requested a review from a team as a code owner January 18, 2025 21:56
@Chaosus Chaosus added this to the 4.4 milestone Jan 19, 2025
@HolonProduction
Copy link
Member

HolonProduction commented Jan 19, 2025

Can't fully test at the moment due to #101089 but it would probably work for the specific case from my issue.

However this approach doesn't fully solve the issue:

extends Control

enum Test {
    SIZE_EXPAND,
    SOMETHINGELSE = SIZE_EXPAND, # looking up SIZE_EXPAND here should also resolve to the enum member.
}

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.

GDScript symbol lookup prefers enum constants over actuall lookup target
3 participants