You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a function auto_free(<instance>) : Object to register instances to be get auto freed after test execution on my plugin GdUnit3.
The function signature is func auto_free(obj) -> Object:
and returns the same obj
When going back to the original class, an error occurs at runtime var instance :AdvancedTestClass.AtmosphereData = auto_free(AdvancedTestClass.AtmosphereData.new()) Trying to assign value of type '' to a variable of type 'AdvancedTestClass.gd'.
Steps to reproduce
Copy this code and run it.
class_name TestScene
extends Node
class Custom:
pass
func _ready():
test_wrapper()
func test_wrapper():
# with this inner class it works
var original: = TestScene.Custom.new()
var as_object :TestScene.Custom = auto_free(original)
prints(as_object)
# with this inner class defined in ExampleClass it breaks
var original_: = ExampleClass.Data.new()
# this line fails at runtime
var as_object_ :ExampleClass.Data = auto_free(original_)
# just return same value
func auto_free(value :Object) -> Object:
return value
The external script/class
class_name ExampleClass
extends Resource
class Data:
pass
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered:
Calinou
changed the title
GdScript 2.0: Typed assigning an inner class leads to a runtime error
GDScript 2.0: Typed assigning an inner class leads to a runtime error
Oct 17, 2022
Godot version
v4.0.beta3.official [01ae26d]
System information
Windows 10
Issue description
I have a function
auto_free(<instance>) : Object
to register instances to be get auto freed after test execution on my plugin GdUnit3.The function signature is
func auto_free(obj) -> Object:
and returns the same obj
When going back to the original class, an error occurs at runtime
var instance :AdvancedTestClass.AtmosphereData = auto_free(AdvancedTestClass.AtmosphereData.new())
Trying to assign value of type '' to a variable of type 'AdvancedTestClass.gd'.
Steps to reproduce
Copy this code and run it.
The external script/class
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: