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

No warning when attempting to access native enum types from instance. #97960

Open
nlupugla opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@nlupugla
Copy link
Contributor

nlupugla commented Oct 8, 2024

Tested versions

v4.2.2.stable.official [15073af]

System information

Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 32.0.15.5612) - Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz (4 Threads)

Issue description

The GDScript analyzer does not warn about accessing Enum types from an instance.

For example, in a script that extends Node, print(self.ConnectFlags) does not raise a warning from the analyzer, yet produces the runtime error "Invalid get index 'ConnectFlags'". This behavior feels inconsistent with how accessing other global properties work. For example print(self.Object) raises the analyzer warning "The property "Object" is not present on the inferred type". On the other hand accessing an Enum value from an instance, e.g., print(self.CONNECT_DEFERRED) runs without error and prints the correct value.

Steps to reproduce

extends Node

func _ready():
	print(self.ConnectFlags)

Minimal reproduction project (MRP)

N/A

@dalexeev dalexeev changed the title No warning when attempting to access Enum types from instance. No warning when attempting to access native enum types from instance. Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Up for grabs
Development

No branches or pull requests

2 participants