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
The exact error I receive is: Parser bug (please report): Trying to check compatibility of unset value type
The error occurs whenever I have a func with a strict return type defined using ->, and when I use the and or or operators, or an equality operator (==, !=, etc.) in a return statement.
The parser seems to be choking on the operators themselves. The issue only seems to occur when only the first (left-hand) operand is present.
Steps to reproduce
Step-by-step guide
Write the header for a function
Give it any strict return type. bool is the most viable since the affected operators return bools, but you can use any return type. The bug occurs regardless of whether or not the code is valid.
In the function body, add a return statement.
Put any primitive or a variant name after return.
Add either the or or and operator.
Wait a moment for the parser to notice the operator. As soon as it does, the error message will appear in the output.
Hold down the control key. The error will be output repeatedly, as long as you hold the key, and as long as the script editor is focused (you may need to place your mouse cursor over some text for this to work).
Specific examples
Using the editor's default GDScript editor, type this:
func my_func() -> bool:
return true or
Give the editor a moment to process after you type the "r" in or. You can substitute or with and for the same result.
Equality comparisons also cause the error
func foo() -> bool:
return true !=
All of the affected operators, as I've been able to find so far, are:
and
or
==
!=
<=
>=
You can also substitute true for a variant or any other primitive, the result is the same.
func foo() -> int:
return "something" and
func bar() -> RandomNumberGenerator:
var a = "something"
return a and
The following code does not cause the error to occur. It simply causes an "Expected end of statement after return" error in the editor, as expected.
func foo() -> bool:
return and true
Typing anything after the operator does not cause the error. The following code is perfectly fine as it appears, but will cause the error as it is being typed-out.
func foo() -> bool:
return true or false
Typing a whitespace character (space or indent) after the operator will not cause the error to appear immediately. It will cause the error if you hold down the control key, assuming you haven't typed anything else after the whitespace.
The operators is and asdo not appear to cause this error. Most arithmetic operators (+-/*%) also seem fine, as do the non-equal inequality operators (< and >) I do not know about any other operators at this time.
Minimal reproduction project
func my_func() -> bool:
return true or
The text was updated successfully, but these errors were encountered:
Godot version
v4.1.1.stable.official [bd6af8e]
System information
Windows 10
Issue description
The exact error I receive is:
Parser bug (please report): Trying to check compatibility of unset value type
The error occurs whenever I have a
func
with a strict return type defined using->
, and when I use theand
oror
operators, or an equality operator (==
,!=
, etc.) in areturn
statement.The parser seems to be choking on the operators themselves. The issue only seems to occur when only the first (left-hand) operand is present.
Steps to reproduce
Step-by-step guide
bool
is the most viable since the affected operators return bools, but you can use any return type. The bug occurs regardless of whether or not the code is valid.return
.or
orand
operator.Specific examples
Using the editor's default GDScript editor, type this:
Give the editor a moment to process after you type the "r" in
or
. You can substituteor
withand
for the same result.Equality comparisons also cause the error
All of the affected operators, as I've been able to find so far, are:
and
or
==
!=
<=
>=
You can also substitute
true
for a variant or any other primitive, the result is the same.The following code does not cause the error to occur. It simply causes an "Expected end of statement after return" error in the editor, as expected.
Typing anything after the operator does not cause the error. The following code is perfectly fine as it appears, but will cause the error as it is being typed-out.
Typing a whitespace character (space or indent) after the operator will not cause the error to appear immediately. It will cause the error if you hold down the control key, assuming you haven't typed anything else after the whitespace.
The operators
is
andas
do not appear to cause this error. Most arithmetic operators (+-/*%) also seem fine, as do the non-equal inequality operators (< and >) I do not know about any other operators at this time.Minimal reproduction project
The text was updated successfully, but these errors were encountered: