Strange message declaring a Pointer[void] in a NativeCall perl6 module


Strange message declaring a Pointer[void] in a NativeCall perl6 module



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 uses the other one, and a program.
This is the first module:


use


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?


$.wrongdoer





Declaring test1 and using it by itself also works... Declaring A and instantiating it causes no problem either, either in 2018.03 or 2018.06. Can you please try and check again?
– jjmerelo
Jul 1 at 10:48



test1





If you remove the [void] it doesn't generate that error.
– Brad Gilbert
Jul 1 at 15:57


[void]




1 Answer
1



As suggested by Brad Gilbert, removing the [void] stops the spooky action at a distance.


[void]






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to add background colour in existing image using Swift?

What's the difference between DDS and SOME/IP?

How to make file upload 'Required' in Contact Form 7?