diff options
author | Antonio Dell'Annunziata <contact@antonio-da.dev> | 2022-07-29 10:21:11 +0200 |
---|---|---|
committer | Antonio Dell'Annunziata <contact@antonio-da.dev> | 2022-07-29 10:22:55 +0200 |
commit | 7b975b50dc0b7b54d9672ea00447d4a3a591a72f (patch) | |
tree | 1149aaf9819bcbaa38a9b6fd56d2bd34e0c0e3af | |
parent | 9869182e8a01f803208d319bce8087fd2ff035b4 (diff) |
fix(gdscript): Fix infinite loop on type inferernce from super method calls
When infering the type from a `super()` call, the gdscript_editor didn't use the base class to search for the original implementation of the method, but instead searched in the extending class.
This caused the same function to be analyzed for type inference which created the infinite loop.
Solves #63592
-rw-r--r-- | modules/gdscript/gdscript_editor.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 90dcfa307e..d943974ce4 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1473,11 +1473,16 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context, if (callee_type == GDScriptParser::Node::IDENTIFIER || call->is_super) { // Simple call, so base is 'self'. if (p_context.current_class) { - base.type.kind = GDScriptParser::DataType::CLASS; - base.type.type_source = GDScriptParser::DataType::INFERRED; - base.type.is_constant = true; - base.type.class_type = p_context.current_class; - base.value = p_context.base; + if (call->is_super) { + base.type = p_context.current_class->base_type; + base.value = p_context.base; + } else { + base.type.kind = GDScriptParser::DataType::CLASS; + base.type.type_source = GDScriptParser::DataType::INFERRED; + base.type.is_constant = true; + base.type.class_type = p_context.current_class; + base.value = p_context.base; + } } else { break; } |