Hi,

I am getting an error and don't know why it happens, it might even be a bug. It is about an assignment to a CStruct variable.

The structure is defined like;

class cairo_path_data_point_t is repr('CStruct') is export {
  has num64 $.x;
  has num64 $.y;

  submethod TWEAK ( :$native-object ) {
    $!x = $native-object.x;
    $!y = $native-object.y;
  }
}


The error is generated when typed variables are used (below, $x is also a cairo_path_data_point_t);

my cairo_path_data_point_t $p1 = $x;

or

my cairo_path_data_point_t $p1 = cairo_path_data_point_t.new(:native-object($x));

but not with

my cairo_path_data_point_t $p1 .= new(:native-object($x));

or

my $p1 = $x;

After which all fields in the structure are happely accessable using $p1!


The error is

Type check failed in assignment to $p1; expected cairo_path_data_point_t but got cairo_path_data_point_t.new(x => 0e0, y => 0e0)


Raku version: 2020.06-7-gf1960baa9 built on MoarVM version 2020.06-6-gbf6af07de
implementing Raku 6.d.

The content of the structure does not matter, I've seen it with other structures too.

Regards,
Marcel

Reply via email to