godot icon indicating copy to clipboard operation
godot copied to clipboard

GDScript 2.0: Condition `ret.type != BOOL` is true. Returning: `false` during parsing in 4.0.alpha12 and later

Open James103 opened this issue 1 year ago • 4 comments

Godot version

Since 4.0 alpha 12

System information

Windows 10, 64-bit

Issue description

When writing some code to initialize a variable based on the value of a key in a dict, the GDScript parser reports some errors like below:

Godot Engine v4.0.alpha12.official.2c11e6d9e - https://godotengine.org
Vulkan API 1.2.0 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1660
...
ERROR: Parser bug (please report): tried to assign unset node without an identifier.
   at: resolve_class_interface (modules/gdscript/gdscript_analyzer.cpp:656)
ERROR: Condition "ret.type != BOOL" is true. Returning: false
   at: in (core/variant/variant_op.cpp:974)

Steps to reproduce

  1. Create a new empty project and open it.
  2. Create a new script in the project.
  3. In the GDScript editor, paste in the following code:
extends Node

var test_arr = [
	{"a": 1}
]

var test_val = test_arr[0]
  1. Type a . at the end. Notice ERROR: Parser bug (please report): tried to assign unset node without an identifier. has been logged to the console.
  2. Type a letter at the end, after the .. Notice ERROR: Condition "ret.type != BOOL" is true. Returning: false has been logged to the console.

Minimal reproduction project

test.zip

James103 avatar Aug 07 '22 08:08 James103

Just some additional information: I can confirm that the error ERROR: Condition "ret.type != BOOL" is true. Returning: false doesn't occur on 4.0 alpha 11, so it has to have been introduced in alpha 12. ERROR: Parser bug (please report): tried to assign unset node without an identifier. however did exist since at least alpha 5. Tested on POP_OS 22.04.

AntonioDell avatar Aug 07 '22 12:08 AntonioDell

Condition "ret.type != BOOL" is true. Returning: false still happening on Godot 4.0 beta 2.

CassianoBelniak avatar Oct 12 '22 22:10 CassianoBelniak

It's still happening in 4.0 beta3

nofacer avatar Oct 21 '22 15:10 nofacer

I get this error in Godot 4.0 beta 16. It also appears when you hold control and hover over the variant function call after the "." For example the error pops up when you hold control and hover the cursor over append some_array[0].append

XeroWolf avatar Jan 29 '23 16:01 XeroWolf

I believe this is fixed already, the mentioned error message does not even exist anymore (probably became not relevant).

vnen avatar Feb 24 '23 15:02 vnen