Skip to content

Commit

Permalink
Merge pull request #70642 from vonagam/fix-constructor-call-type
Browse files Browse the repository at this point in the history
Fixes #70605
  • Loading branch information
Chaosus authored Dec 29, 2022
2 parents 7e1bd3f + f67aa3e commit a754930
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/gdscript/gdscript_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4174,7 +4174,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bo
r_default_arg_count++;
}
}
r_return_type = found_function->get_datatype();
r_return_type = p_is_constructor ? p_base_type : found_function->get_datatype();
r_return_type.is_meta_type = false;
r_return_type.is_coroutine = found_function->is_coroutine;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class A:
func _init():
pass

class B extends A: pass
class C extends A: pass

func test():
var x := B.new()
print(x is C)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GDTEST_ANALYZER_ERROR
Expression is of type "B" so it can't be of type "C".

0 comments on commit a754930

Please sign in to comment.