godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.33k stars 21.24k forks source link

Problems inferring type of variables in an autoloaded node's script at runtime #98270

Open tracefree opened 1 month ago

tracefree commented 1 month ago

Tested versions

System information

Godot v4.4.dev3 - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 on Wayland - Wayland display driver, Single-window, 2 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (nvidia; 560.35.03) - AMD Ryzen 5 2600X Six-Core Processor (12 threads)

Issue description

I noticed that type inference does not work under very specific circumstances: when inferring the type of properties of a script that is attached to the root node of an autoloaded scene via the global autoload name within the script itself, or within another script that is used by the autoloaded script. The problem only occurs at runtime - in the editor the lines are shown as being typed and autocompletion works as well, but when running the project it's as if type inference did not work at all. See the reproduction steps and MRP below.

Screenshot showcasing the error described above, type inference works in the editor but fails and causes a crash at runtime.

Steps to reproduce

Minimal reproduction project (MRP)

type_inference_mrp.zip

AThousandShips commented 1 month ago

Sounds the same as:

tracefree commented 1 month ago

Ah yes, that does seem to be the same issue!