Cannot resolve caller push(Buf:U: Int:D); none of these signatures matches:
(Buf:D: int $got, *%_)
(Buf:D: Int:D $got, *%_)
(Buf:D: Mu:D $got, *%_)
(Buf:D: Blob:D $buf, *%_)
(Buf:D: **@values, *%_)
in block <unit> at bufpush.raku line 11
Comparing the found signature with each of the suggested ones reveals a near-match:
(Buf:D: Int:D $got, *%_)
The only difference is that Buf:D
vs Buf:U
thing (called the invocant marker
) at the front of the signature. It specifies the invocant (the object / thing the method can be invoked on). It's optional, by default it's allowed to call a method both on an object as well as the class. Most often the invocant marker is used to specify whether the method is only allowed to be called on type objects (e.g. Blob.allocate) or on concrete objects (e.g. Blob.gist). Buf:D
means a Defined Buf
object, Buf:U
means an Undefined Buf
type object.
So from the above we can learn that the code tried to call push
on a type object, so $data2
is undefined. Changing my Buf $data2;
to my Buf $data2 .= new;
fixes the issue.