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.
Steps to reproduce
Add an "autoload" scene to the project
In the root node of that scene, attach a script
In that script, add variables with types
Also in that script, write functions where the type of those variables is being inferred (using the global autoload name)
Alternatively, do that in another script that is loaded by the autoloaded node's script
It works in the editor, but at runtime you will get warnings / errors
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.
Steps to reproduce
Minimal reproduction project (MRP)
type_inference_mrp.zip