Browse Source

Merge pull request #73693 from vnen/gdscript-fix-script-signature-check

GDScript: Fix override signature check of script inheritance
Rémi Verschelde 2 years ago
parent
commit
253396ba39

+ 1 - 0
modules/gdscript/gdscript_analyzer.cpp

@@ -1538,6 +1538,7 @@ void GDScriptAnalyzer::resolve_function_signature(GDScriptParser::FunctionNode *
 		// Check if the function signature matches the parent. If not it's an error since it breaks polymorphism.
 		// Not for the constructor which can vary in signature.
 		GDScriptParser::DataType base_type = parser->current_class->base_type;
+		base_type.is_meta_type = false;
 		GDScriptParser::DataType parent_return_type;
 		List<GDScriptParser::DataType> parameters_types;
 		int default_par_count = 0;

+ 10 - 0
modules/gdscript/tests/scripts/analyzer/features/inheritance_signature_check_no_meta.gd

@@ -0,0 +1,10 @@
+func test():
+	print("ok")
+
+# https://github.com/godotengine/godot/issues/71994
+class A:
+	extends RefCounted
+class B:
+	extends A
+	func duplicate():
+		pass

+ 2 - 0
modules/gdscript/tests/scripts/analyzer/features/inheritance_signature_check_no_meta.out

@@ -0,0 +1,2 @@
+GDTEST_OK
+ok