-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typehints on inner classes do not recognize function argument types #64915
Comments
I have the same issue, the workaround I found was to explicitly convert to the subclass when passing an argument to a method. ( |
Turns out I was wrong, converting to the subclass returns null. With other corrections I needed to make to convert to Godot 4 I didn't realise that this was the cause of one of my bug. Should I open another bug report? It might be the same problem where some part of gdscript doesn't recognize an instance of a subclass as that |
This seems, at first glance, linked to #65953, where the base class is not set well. I will try to investigate this. |
There have been issues with inner classes and type declarations before. But I was able to reproduce a similar issue here by referencing an inner class from a different file.
here's a test project for this if you want to try it (see the versions |
tested that #68374 fixes this |
Godot version
9c9b8fc
System information
Windows 10
Issue description
I use a lot of inner classes in my project to structure my data better and in Godot 3.5+ I was able to instantiate an inner class and use it as a function argument type. Attempting this in Godot 4 results in a compilation error:
This line comes from
godot/modules/gdscript/gdscript_vm.cpp
Line 166 in 7199314
RefCounted
:This might relate to #61567 and #61635 however, they mention very specific use-cases while I am just trying to use the type itself.
Steps to reproduce
Create some inner classes with inheritance and then register that namespace class as a autoload singleton:
Attempt to use the inner classes as types:
Minimal reproduction project
gdscript-inner-classes.zip
The text was updated successfully, but these errors were encountered: