Skip to content

Conversation

@cpl-s-matsuyama
Copy link
Contributor

This PR fixes the issue where get_dependencies() would return an empty list in certain cases, as reported in #90643.

This is a re-implementation of the fix attempted in #90860, which was subsequently reverted in #91908 due to a regression reported in #91726 (import errors).

Unlike the previous attempt, this implementation avoids the regression by deferring the dependency resolution. The previous attempt resolved dependencies immediately, which led to the reported import errors. This approach ensures that dependencies are handled safely without interfering with the parsing process.

I have verified that this solution fixes the original issue (#90643) without causing the regression reported in #91726.

Fixes #90643

vnen and others added 2 commits December 9, 2025 15:51
The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.

What is considered a dependency:

- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
Delay the resolution of script dependencies until after the pending
updates are processed to avoid issues with initialization order.
@cpl-s-matsuyama cpl-s-matsuyama requested review from a team as code owners December 9, 2025 08:35
@dalexeev
Copy link
Member

dalexeev commented Dec 9, 2025

Thanks for the PR! However, I'm not sure this is even possible if we want to provide a full dependency graph. The resource system doesn't support circular dependencies, unlike GDScript. The concern is that this will cause issues on the resource system side, not to implement on the GDScript side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResourceFormatLoaderGDScript::get_dependencies always returns an empty list

3 participants