Make type not found errors more informative.

This PR removes a check for whether a datatype is a meta type when
generating a datatype's to_string() result. This means that error
messages that fail to find the type will now print their class names,
which is much more useful when trying to identify errors.
This commit is contained in:
ocean (they/them) 2023-04-02 18:10:32 -04:00
parent df7834ac96
commit 5d164df4e1
3 changed files with 8 additions and 3 deletions

View File

@ -4121,9 +4121,6 @@ String GDScriptParser::DataType::to_string() const {
}
return native_type.operator String();
case CLASS:
if (is_meta_type) {
return GDScript::get_class_static();
}
if (class_type->identifier != nullptr) {
return class_type->identifier->name.operator String();
}

View File

@ -0,0 +1,6 @@
class InnerClass:
pass
func test():
var x : InnerClass.DoesNotExist
print("FAIL")

View File

@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Could not find type "DoesNotExist" under base "InnerClass".