From f67aa3e46d1f100cc6788353bf6c50f2175250e9 Mon Sep 17 00:00:00 2001 From: Dmitrii Maganov Date: Tue, 27 Dec 2022 22:49:26 +0200 Subject: GDScript: Fix return type of constructor call for extending class --- .../tests/scripts/analyzer/errors/constructor_call_type.gd | 10 ++++++++++ .../tests/scripts/analyzer/errors/constructor_call_type.out | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.gd create mode 100644 modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.out (limited to 'modules/gdscript/tests') diff --git a/modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.gd b/modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.gd new file mode 100644 index 0000000000..251be70088 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.gd @@ -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) diff --git a/modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.out b/modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.out new file mode 100644 index 0000000000..91d5125ec0 --- /dev/null +++ b/modules/gdscript/tests/scripts/analyzer/errors/constructor_call_type.out @@ -0,0 +1,2 @@ +GDTEST_ANALYZER_ERROR +Expression is of type "B" so it can't be of type "C". -- cgit v1.2.3