These snippets of code may seem odd, it's because I started with my original code and cut off pieces until I arrived to the minimal set of instructions that reproduced the error. So bear with the apparent uselessness.
There are two perl6 modules, one use
s the other one, and a program.
This is the first module:
unit class test1;
use NativeCall;
use test2;
method test
{
my Pointer[void] $dummy .= new;
}
The second module is included by the first one, but no part of it is actually used:
unit module test2;
use NativeCall;
class A is repr('CStruct') is export {
has Pointer[void] $.wrongdoer;
has int32 $.a;
}
The program creates a test1 object and calls the test method:
use lib '.';
use test1;
my test1 $t .= new;
$t.test;
This program outputs an error, apparently caused by the assignment in the class test1's method test:
Type check failed in assignment to $dummy; expected NativeCall::Types::Pointer[NativeCall::Types::void] but got NativeCall::Types::Pointer[NativeCall::Types::void].new(0)
If I comment out the $.wrongdoer
in the second class, the program executes with no error.
I'm running rakudo 2018.06.
Is this a bug in the NativeCall module or something else I fail to see?
As suggested by Brad Gilbert, removing the [void]
stops the spooky action at a distance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With