-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
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
GDScript 2.0: type assignment is broken with Godot4 beta9 #70364
Comments
The two errors appear to be two different issues caused by two different commits. The first error Will bisect the other issue and come back :) |
Second issue is from #69518 cc @rune-scape Sorry to keep throwing stuff at you :) At least I hope some of these are helpful to track stuff down. I don't know that I have it in me for right now. |
hmm, maybe my change in #69518 wasn't right. |
I have #69163 which should fix the second issue. |
Good stuff, sounds like we're well on our way to getting these issues fixed :) |
as for the first one, i didn't change the code responsible for that error, it should have given the same error in the last beta based on this: godot/modules/gdscript/gdscript_analyzer.cpp Lines 825 to 826 in 2a04b18
and this: godot/modules/gdscript/gdscript_analyzer.cpp Lines 1755 to 1756 in 2a04b18
it seems like collapsing this is_variant() and the has_no_type() branch into an is_hard_type() check would make more sense, and fix the issue
|
I have not touched the first issue in that PR because the error explicitly said that inference should not work with |
@vonagam i tested the build artifact with the MRP and it doesn't fix the issue, you'd need to check if they are reduced constants, then check the type of the reduced value |
I did test that it worked on beta 8 and didn't on beta 9, and did a git bisect which did identify the out-of-order member resolution PR as the introduction of regression for the first thing. I was really confused too, because being able to resolve things in different orders shouldn't change their types :/ |
My mistake, yes, other things are broken because var x := null It works when it should not, because other parts of code expect Since Edit: I updated my PR to allow |
@vonagam might be worth tagging this as partially closed in your PR as well! I just reviewed that and it looks good, plus partially deals with this situation! 👍 |
👍 |
This bug is still dear in beta 10!
res://new_script.gd:10 - Parse Error: Could not infer the type of the variable "arg_default" because the initial value is a variant. Use explicit "Variant" type if this is intended. |
Well, there were two errors, they were fixed in two different PRs. |
gotcha 👍 |
Godot version
v4.0.beta9.official [e780dc3]
System information
Windows 10
Issue description
After upgrade from Godot4 beta 8 to beta 9, my scripts are broken by script parsing errors.
It looks like the type assignment are broken.
Steps to reproduce
Godot Engine v4.0.beta9.official (c) 2007-2022 Juan Linietsky, Ariel Manzur & Godot Contributors.
modules/gltf/register_types.cpp:61 - Blend file import is enabled in the project settings, but no Blender path is configured in the editor settings. Blend files will not be imported.
--- Debug adapter server started ---
--- GDScript language server started ---
res://test.gd:6 - Parse Error: Could not infer the type of the variable "arg_default" because the initial value is a variant. Use explicit "Variant" type if this is intended.
res://test.gd:11 - Parse Error: Could not infer the type of the variable "x2" because the initial value is a variant. Use explicit "Variant" type if this is intended.
Minimal reproduction project
assign_bug.zip
The text was updated successfully, but these errors were encountered: