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

GDScript: Add missing member type check when resolving extends #75879

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

dalexeev
Copy link
Member

Closes #75870.

@@ -506,6 +523,9 @@ Error GDScriptAnalyzer::resolve_class_inheritance(GDScriptParser::ClassNode *p_c
if (!id_type.is_set()) {
push_error(vformat(R"(Could not find nested type "%s".)", id->name), id);
return ERR_PARSE_ERROR;
} else if (id_type.kind != GDScriptParser::DataType::SCRIPT && id_type.kind != GDScriptParser::DataType::CLASS) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have some doubts about this. We should probably check if the identifier is a class or a constant containing a script/class. Also, I am not happy with the variety of error messages:

  • Constant "A" is not a preloaded script or class.
  • Identifier "X" is not a preloaded script or class.
  • Cannot get nested types for extension from non-GDScript type "RefCounted".
  • Could not find nested type "Baz".
  • Cannot use variable "A" in extends chain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's fix the crash for now, and iterate on this in a follow-up.

@YuriSizov YuriSizov merged commit afca0b8 into godotengine:master Apr 14, 2023
@YuriSizov
Copy link
Contributor

Thanks!

@dalexeev dalexeev deleted the gds-fix-extends-crash branch April 14, 2023 13:14
@dalexeev dalexeev restored the gds-fix-extends-crash branch April 14, 2023 13:14
@dalexeev dalexeev deleted the gds-fix-extends-crash branch April 14, 2023 13:14
@dalexeev dalexeev restored the gds-fix-extends-crash branch April 14, 2023 13:15
@dalexeev dalexeev deleted the gds-fix-extends-crash branch April 14, 2023 13:15
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.0.3. This one slightly depends on #74844, but seems like usages of id can just be reverted to use p_class, which is what I did to fix up when picking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants