-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Conversation
a34753c
to
9a3aedd
Compare
9a3aedd
to
66279b9
Compare
@@ -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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Thanks! |
Cherry-picked for 4.0.3. This one slightly depends on #74844, but seems like usages of |
Closes #75870.