type error [M0098], cannot implicitly instantiate function of type
<A>([A], [A]) -> [A]
to argument of type
([var (Nat, Nat)], [var (Nat, Nat)])
to produce result of type
[var (Nat, Nat)]
because no instantiation of A/73 makes
([var (Nat, Nat)], [var (Nat, Nat)]) <: ([A/73], [A/73])
and
[A/73] <: [var (Nat, Nat)]
I have known that the error can be handled by add the <T> after the Array.append function if the array is a immutable array, but here buffer is a mutable array
Array.append only works on immutable arrays (the ones without var), and mutable arrays (the ones with var) are a completely separate type. You could implement your own append_var function, but really, when you are appending arrays, you are probably using the wrong type. Have a look at the buffer type in the base library!