Godot version
v4.0.alpha.custom_build [19e3c7f]
Not reproducible in 3.4.4
System information
Arch on 5.15.41-1-lts
Issue description

Steps to reproduce
-
test.gd:
extends Node
var hello := "world"
scene.gd:
extends Node
func _ready() -> void:
var x := Test.hello
test.tscn - Empty scene with test.gd, add as singleton.
scene.tscn - Empty scene with scene.gd, set as main scene.
-
Notice the GDScript error in scene.gd.
Minimal reproduction project
3.4.4 (no reproducible): test1.zip
4.x (reproducible): test2.zip
Godot version
v4.0.alpha.custom_build [19e3c7f]
Not reproducible in 3.4.4
System information
Arch on 5.15.41-1-lts
Issue description
Steps to reproduce
test.gd:scene.gd:test.tscn- Empty scene withtest.gd, add as singleton.scene.tscn- Empty scene withscene.gd, set as main scene.Notice the GDScript error in
scene.gd.Minimal reproduction project
3.4.4 (no reproducible): test1.zip
4.x (reproducible): test2.zip