Skip to content
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

Pulling GDScript changes that introduce a new class_name results in errors #92054

Open
mihe opened this issue May 17, 2024 · 0 comments
Open

Comments

@mihe
Copy link
Contributor

mihe commented May 17, 2024

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:

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

  1. Open the MRP.
  2. Once loaded, run git checkout b64a4b4dd.
  3. Note the errors shown in the editor's Output pane.
  4. Reload the project.
  5. Note the absence of any errors.

(To go back to the initial commit, do git checkout f4f9e9d17.)

Minimal reproduction project (MRP)

ClassNamePullErrors.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: For team assessment
Development

No branches or pull requests

2 participants