GDScript: Fix override signature check of script inheritance
Avoid treating the super class as a meta type for signature check, since it is looking at the instance level for that.
This commit is contained in:
parent
7e79aead99
commit
1731010774
3 changed files with 13 additions and 0 deletions
|
@ -1534,6 +1534,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.
|
// 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.
|
// Not for the constructor which can vary in signature.
|
||||||
GDScriptParser::DataType base_type = parser->current_class->base_type;
|
GDScriptParser::DataType base_type = parser->current_class->base_type;
|
||||||
|
base_type.is_meta_type = false;
|
||||||
GDScriptParser::DataType parent_return_type;
|
GDScriptParser::DataType parent_return_type;
|
||||||
List<GDScriptParser::DataType> parameters_types;
|
List<GDScriptParser::DataType> parameters_types;
|
||||||
int default_par_count = 0;
|
int default_par_count = 0;
|
||||||
|
|
|
@ -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
|
|
@ -0,0 +1,2 @@
|
||||||
|
GDTEST_OK
|
||||||
|
ok
|
Loading…
Reference in a new issue