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: Fix "Identifier not found" error when accessing inner class from inside #80510

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/gdscript/gdscript_analyzer.cpp
Expand Up @@ -3469,6 +3469,9 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
for (GDScriptParser::ClassNode *script_class : script_classes) {
if (p_base == nullptr && script_class->identifier && script_class->identifier->name == name) {
reduce_identifier_from_base_set_class(p_identifier, script_class->get_datatype());
if (script_class->outer != nullptr) {
p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CLASS;
}
return;
}

Expand Down
@@ -0,0 +1,21 @@
# GH-80508

class A:
func a():
return A.new()
func b():
return B.new()

class B:
func a():
return A.new()
func b():
return B.new()

func test():
var a := A.new()
var b := B.new()
print(a.a() is A)
print(a.b() is B)
print(b.a() is A)
print(b.b() is B)
@@ -0,0 +1,5 @@
GDTEST_OK
true
true
true
true