-
-
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
GDScript 2.0: "Parser bug (please report): Trying to check compatibility of unset value type" error #44375
Comments
@TotCac Please upload a minimal reproduction project to make this easier to troubleshoot. We absolutely need a minimal reproduction project here. Also, please specify the commit hash of your 4.0 build as "latest |
build a511a26 I can't upload my whole project. How can I get more information on the context? |
I'm not sure if you can do much more. Maybe setting a breakpoint in the C++ source could help, but I'm not sure. cc @vnen |
I'll close this issue as no minimal reproduction project was provided in time. This issue can be reopened if someone uploads a minimal reproduction project. |
I really don't understand why you close it while in code, where the error pop, there is comment like this: and
|
We need a minimal reproduction project to be able to diagnose this, unless @vnen is already aware of a solution to this issue somehow. |
After days (weeks) of investigating, I find where does error come from. On 3.2 i use to define a method like this
On 4.0 i have the error shown in title
I have no idea if the issus should be close of not. |
If I declare
The error pop too When I use
Maybe it has something to do with static typing and initialization |
Here's a reasonably minimal project that gets this error on Godot v4.0.dev.calinou.de83ee57e I'm not really sure what's causing it so I'm just following up with a Please Report. If you run the project and click on it in the error line, it'll point to the line in my project which claims is the source of the problem. |
I got the same error when I try to create a Thread, it crash when I launch a start() |
This issue report is a bit messy, but @Gastronok's repro project works and I can reproduce the parser bug on 85186bc
(even if I add a Note that another bug exists with this error: #50313 - I also see this error all the time in my own projects, so it's not super hard to reproduce given complex GDScript. |
The error caused by |
The simple reproduction script will be:
|
Hello! I'm not 100% sure that source of this issue is the same, but here it is: I've made mini-project for you: Error is in file PlayerAttrs.gd. Error is somehow linked to use of both enum type hint and singleton (I think). Hope this helps! |
For me this issue is partly resolved by renaming the unparsable class as mentionned in this (duplicate?) ticket : #63439 But only partly because I then get the error on other classes Update: Doing a |
Just discovered that issue recently, porting one of my old projects to Godot 4 (beta 1). Doing my own tests, I've found that the following code: extends Node2D
var some_var: int = some_func()
func some_func() -> int:
return 42 Reports the following on the console:
However, if I declare the variable after the function, no errors are reported. I've tried a few combinations, declaring the function as I hope that helps a little. |
I see this issues exactly as described by @rblopes in 4.0-beta2
causes the problem. Related, it gives me an error if I attempt type inference on the var as
In the meantime, my workaround is to set manually in
|
Here is one very simple minimal reproduction code (for Godot 4.0.beta4) - the effects are near immediate (don't even need to save, just comment/uncomment the lines). So in words, one way to trigger the error is by 1. declaring a class member 2. after declaring a function that uses 3. the member as a default value for an argument 4. with typing. It's okay to use it inside the function though (just not for the arguments), and it's also okay if you don't use type for the argument. Note also that you'll get the error for any scripts open in the script editor, and accordingly if you open Godot with such scripts left open in the editor, you'll be welcomed with some red lines on start up. Not knowing how it works, but.. Conceptually speaking, if the problem is unset value type, one solution could be to add an extra "run" to the parser, where it collects any default argument refs and fetches the type from them (= sets the value type) - before going on to parsing the arguments further. Or more brutely, doing that run in any case for all the class members (before parsing function arguments). UPDATE (beta6): The above situation still throws an error in Godot v4.0.beta6, but now the message is: |
Please check if this is reproducible in master. Maybe #67714 fixed that too. |
Tested that at least the issue reported in the above screenshot still exists in Godot 4.0.beta5. (The error seems to be triggered just like in beta4.) |
From what I have tested: Fixed in master#44375 (comment) is fixed in the master. In v4.0.beta5.official [89a33d2]:
In v4.0.beta.custom_build [c2f0353]: Not fixed in master#44375 (comment) is not fixed in the master. In v4.0.beta5.official [89a33d2]:
v4.0.beta.custom_build [c2f0353]:
#44375 (comment) is not fixed in the master. In v4.0.beta5.official [89a33d2]:
v4.0.beta.custom_build [c2f0353]:
#44375 (comment) is not fixed in the master. v4.0.beta5.official [89a33d2]:
v4.0.beta.custom_build [c2f0353]:
|
I think this might be related to cyclic class references. Before beta6 this didn't compile at all, but after the improvement/fix in 4.0.beta6 ( #67714 ) you can now have these references. Or, at least the game compiles and runs, but I still get this error (same as above) if I set up a simple cyclic class reference.
The cyclic class reference I tested was a simple one: One node of the class GameBoard has a number of child nodes of the class BoardObject, both classes inherit from Node3D. If I in the script for BoardObject reference the class GameBoard I get the error above when I run the game. If I remove the reference to GameBoard in BoardObject the error goes away. |
@cassandrus I tested your project, you need to make the script |
I think it will do the trick, but why? Is this incorrect usage or just a workaround? Docs page states "You can create an AutoLoad to load a scene or a script that inherits from Node" and "Note that autoload objects (scripts and/or scenes) are accessed just like any other node in the scene tree". Is it incorrect? No more correct? |
I think it's correct, but maybe not in the context of accessing an enum from that script as type hint. This would warrant a dedicated issue. |
You can use a scene or script for autoload but GDScript will not look into an autoloaded scene to check its contents, so for GDScript it is only a regular |
Godot version:
current master 4.0 a511a26
OS/device including version:
Windows 10
Issue description:
E 0:00:00:0827 is_type_compatible: Parser bug (please report): Trying to check compatibility of unset value type
<C++ Error> Condition "!p_source.is_set()" is true. Returning: true
<C++ Source> modules/gdscript/gdscript_analyzer.cpp:3157 @ is_type_compatible()
Steps to reproduce:
I don't know because debugger don't show me where it is in my code.
Empty project don't do that
Minimal reproduction project:
n/a
The text was updated successfully, but these errors were encountered: