godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.48k stars 21.26k forks source link

GDScript compilation error with no description in built-in scripts #95563

Open smedelyan opened 3 months ago

smedelyan commented 3 months ago

Tested versions

System information

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 (NVIDIA; 32.0.15.6081) - AMD Ryzen 7 2700X Eight-Core Processor (16 Threads)

Issue description

I'm yet to figure out the context and describe the issue precisely. I've opened my project (previously on 4.2.2) in newly released 4.3 and that gave me a fuzzy compilation error: image

Also, this seems to cause this error next:

Invalid call. Nonexistent function 'new' in base 'GDScript'

Also, the editor crashes on exit with no helpful information: image

I tried to remove .godot/ folder, but that didn't help.

Context about project setup (something may be irrelevant to the issue, but I don't know what might be actually useful):

  1. I have a custom graph-based (GraphNode, GraphEdit) plugin for the editor. It also allows to configure custom GUI for particular data types via calling a static register_gui() function (which puts that gui in static Dictionary)
  2. configure_ineditor_plugins.gd is an autoload where all those register_gui() are invoked
    • This autoload is automatically added by another plugin called setup in its _enable_plugin() method. This plugin also provides EditorExportPlugin, but I don't believe this matters.
  3. The class that fails to load on the screenshot is a @tool script (basic GUI implementation provided by plugin) from which other @tool scripts (custom GUIs in editor/ folder, project-specific) inherit. This offending class inherits GraphNode which is experimental, but there are no visible errors in its code.
  4. The error comes from configure_ineditor_plugins.gd, but is caused by the compilation error.

Steps to reproduce

Don't have an MRP yet. This just happens when opening the project.

Minimal reproduction project (MRP)

Don't have one yet, sorry

smedelyan commented 5 days ago

I'm trying to debug this myself, but am unable to build the engine from sources. Not sure whether it's worth to open a new issue, for now just posting here: https://forum.godotengine.org/t/line-too-long-when-compiling-engine-with-spine-godot-on-windows/92348 . It's been several days already with no answer, so I hope maybe someone can help me with building this to debug the issue

smedelyan commented 3 days ago

Finally, I've been able to track this down to this line: https://github.com/godotengine/godot/blob/77dcf97d82cbfe4e4615475fa52ca03da645dbd8/modules/gdscript/gdscript_analyzer.cpp#L1300

There was completely no clue about which errors caused the failure, but after debugging the engine I got this error:

Image

I will share a small piece of the relevant code here:

Image

It seems to be related to lambdas. I changed this offending line to reference self.frame (it's a class field) and it compiled OK (though, later when I open a graph, I get a crash with null-reference - have not checked yet whether it's caused by this lambda setup or not).

It's also weird that I don't get any errors for line 140 from this screenshot which looks completely the same to me and should've caused a compile error as well, but it compiled OK.

Ideally, I'd like to see these "other_parser" errors in the output window. For the particular error - I don't think it is correct (I guess, it's quite possible to capture the frame field within lambda scope - but even if this is not correct way to utilize lambdas, then why it's not telling anything on the other line?)


@AThousandShips can you please help me ping the right person to draw some attention to this as I'm afraid this issue got buried already?

AThousandShips commented 3 days ago

This issue is already tracked for GDScript triage so it is probably not buried