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
This is tangentially related to #75388, except this issue does not necessarily need to involve autoloads or plugins.
When you're doing something like pulling in changes to your project from another Git repository, and those changes contain a new GDScript class with a class_name, which is then used in another GDScript file (existing or otherwise) you will be met with errors like this:
res://main.gd:5 - Parse Error: Identifier "SomeNewThing" not declared in the current scope.
modules\gdscript\gdscript.cpp:2895 - Failed to load script "res://main.gd" with error "Parse error". (User)
If you then reload the current project, you'll find that everything parses just fine.
The reason for this seems quite simple. Scripts are loaded and fully parsed as part of EditorFileSystem::_update_scan_actions, and the updating of the global class_name cache happens as part of EditorFileSystem::_update_pending_script_classes, which happens after _update_scan_actions, as seen here.
So the global class_name cache would presumably need to be updated before scripts are fully parsed somehow.
Steps to reproduce
Open the MRP.
Once loaded, run git checkout b64a4b4dd.
Note the errors shown in the editor's Output pane.
Reload the project.
Note the absence of any errors.
(To go back to the initial commit, do git checkout f4f9e9d17.)
Tested versions
Reproducible in: 4.3.dev [bd2300d]
System information
Windows 11 (10.0.22631)
Issue description
This is tangentially related to #75388, except this issue does not necessarily need to involve autoloads or plugins.
When you're doing something like pulling in changes to your project from another Git repository, and those changes contain a new GDScript class with a
class_name
, which is then used in another GDScript file (existing or otherwise) you will be met with errors like this:If you then reload the current project, you'll find that everything parses just fine.
The reason for this seems quite simple. Scripts are loaded and fully parsed as part of
EditorFileSystem::_update_scan_actions
, and the updating of the globalclass_name
cache happens as part ofEditorFileSystem::_update_pending_script_classes
, which happens after_update_scan_actions
, as seen here.So the global
class_name
cache would presumably need to be updated before scripts are fully parsed somehow.Steps to reproduce
git checkout b64a4b4dd
.(To go back to the initial commit, do
git checkout f4f9e9d17
.)Minimal reproduction project (MRP)
ClassNamePullErrors.zip
The text was updated successfully, but these errors were encountered: