godot icon indicating copy to clipboard operation
godot copied to clipboard

No warning when attempting to access Enum types from instance.

Open nlupugla opened this issue 4 months ago • 0 comments

Tested versions

v4.2.2.stable.official [15073afe3]

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

nlupugla avatar Oct 08 '24 00:10 nlupugla