tadzik / JSON-Unmarshal

MIT License
5 stars 9 forks source link

Difficulty with parametric Associatives #24

Closed jonathanstowe closed 7 years ago

jonathanstowe commented 7 years ago

This was reported in https://github.com/jonathanstowe/JSON-Class/issues/3

It seems that a class such as:

use JSON::Unmarshal;

class C {
    has Str %.bla{subset :: of Str where any("ble", "blob")}
}; 

unmarshal( 「{"bla": {"ble": "bli"}}」, C);

Gives rise to:

No appropriate parametric role variant available for 'Associative'
  in sub _unmarshal at /home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/sources/BD58585C8BB103CC821AB89EFD8D30DA4FB8FDF9 (JSON::Unmarshal) line 127
  in block  at /home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/sources/BD58585C8BB103CC821AB89EFD8D30DA4FB8FDF9 (JSON::Unmarshal) line 108
  in sub _unmarshal at /home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/sources/BD58585C8BB103CC821AB89EFD8D30DA4FB8FDF9 (JSON::Unmarshal) line 92
  in sub unmarshal at /home/jonathan/.rakudobrew/moar-nom/install/share/perl6/site/sources/BD58585C8BB103CC821AB89EFD8D30DA4FB8FDF9 (JSON::Unmarshal) line 157
  in block <unit> at jc line 7

I will investigate and try and fix.

jonathanstowe commented 7 years ago

https://github.com/rakudo/rakudo/pull/1048 will fix

jonathanstowe commented 7 years ago

The rakudo patch was applied and fixed this.

Have PRd a test for this behaviour