godot
godot copied to clipboard
The name specified in class_name cannot be used as const.
Godot version
v4.2.beta2.official [f8818f85e]
System information
Godot v4.2.beta2 - Windows 10.0.22621 - Vulkan (Forward+) - integrated AMD Radeon(TM) Graphics (Advanced Micro Devices, Inc.; 31.0.21902.5) - AMD Ryzen 5 5600G with Radeon Graphics (12 Threads)
Issue description
The name specified in class_name cannot be used as const.
Steps to reproduce
An error occurs in "new_script.gd" of the following test project.
Minimal reproduction project
- See also #33531.
Still valid in 4.4. The code in MRP for easier overview:
class_name TestClass
const Other_preload_Class := preload("res://other_class.gd")
class Inner:
pass
const TEST : Array[GDScript] = [
Inner,
OtherClass, # Error
OtherClass.Inner,
Other_preload_Class,
Other_preload_Class.Inner,
]
OtherClass is a class_name and it's the only line that causes errors. Inner classes and preloaded scripts work correctly.