Skip to content

GDScript: More reliably detect cyclic inheritance in script classes #108182

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

squk
Copy link

@squk squk commented Jul 2, 2025

This is my first contribution :) Trying to debug why the editor doesn't display properties for some script base classes and I managed to get this change working.

Different GDScript instances can refer to the same logical GDScript, so comparing pointer values is not reliable.

This change also includes the inheritance chain as a part of the error message.

(There seems to be some race at load time. Prior to this change, I only get the error message in ~2/10 editor runs vs 10/10 with a build using these changes)

Error message before this change:
ERROR: Cyclic inheritance in script class
After:
ERROR: Cyclic inheritance in script class: SwitchBase -> Entity -> SwitchBase

@squk squk requested a review from a team as a code owner July 2, 2025 02:13
@squk squk changed the title More reliably detect cyclic inheritance in script classes GDScript: More reliably detect cyclic inheritance in script classes Jul 2, 2025
@AThousandShips AThousandShips added this to the 4.x milestone Jul 2, 2025
@BrandonGroth
Copy link

I would recommend posting a clear before-and-after of the error. This is so simple, but could easily get spotlighted in a release dev blog for GDScript. I have seen Redditor's burned by this because they couldn't figure out where the cyclic dependency was coming from.

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.

3 participants