Incorrect array element type error for arg when method is called on non-typed class property with non-typed arg #86963
Closed
Description
opened on Jan 8, 2024
Tested versions
- Reproducible in
v4.2.1.stable.arch_linux
System information
Arch Linux
Issue description
A class has a method (some_method
) that accepts an Array[String]
.
some_method
is called with an array containing a constant.
If the class instance is stored as a non-typed property (of another class) and the method is called with an identical array, the engine raises a type error.
Steps to reproduce
Code:
extends Object
var prop
var typed_prop: C
class C:
func trouble_maker(_a: Array[String]): return
func bug():
var local = C.new()
local.trouble_maker([""])
print("local works")
typed_prop = C.new()
typed_prop.trouble_maker([""])
print("typed_prop works")
var arg: Array[String] = [""]
prop = C.new()
prop.trouble_maker(arg)
print("prop with typed arg works")
prop = C.new()
prop.trouble_maker([""])
print("prop with expression arg works")
Output:
local works
typed_prop works
prop with typed arg works
Error:
Invalid type in function '
trouble_maker
' in base 'RefCounted
(C
)'. The array of argument 1 (Array
) does not have the same element type as the expected type array argument.
Minimal reproduction project (MRP)
Minimal reproduction script
extends Object
var prop
class C: func m(_a: Array[String]): return
func f():
prop = C.new()
prop.m([""])
to get the error, run f()
Activity