Skip Menu |
Report information
Id: 126763
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: carsten.hartenfels [at] googlemail.com
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Date: Mon, 30 Nov 2015 00:41:42 +0100
Subject: [BUG] X::AdHoc instead of X::TypeCheck::Binding with subset parameter
From: Carsten Hartenfels <carsten.hartenfels [...] googlemail.com>
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 1001b
This bug is for rakudo version 2015.11-283-g0ede335 built on MoarVM version 2015.11-21-g469ba64 implementing Perl v6.b. Take the following code: subset Empty of Str where /^$/; say "assignment:"; try my Empty $x = "a"; say $!.message; say $!.^name; say "binding:"; sub f(Empty $) {} try f("a"); say $!.message; say $!.^name; This outputs: assignment: Type check failed in assignment to $x; expected Empty but got Str X::TypeCheck::Assignment binding: Constraint type check failed for parameter '<anon>' X::AdHoc The X::AdHoc is wrong I think, it should be a X::TypeCheck::Binding, analogous to the assignment. Using a non-subset type also works correctly, if you can get it through the compiler saying it'll never work: sub g(Str $) {} try g(False ?? "" !! 1); # thwart compiler say $!.message; say $!.^name; Outputs: Type check failed in binding <anon>; expected Str but got Int X::TypeCheck::Binding
Should the type of exception be X::TypeCheck::Argument? (Found in src/core/Exception.pm)
Download (untitled) / with headers
text/plain 221b
On Thu Oct 20 10:10:42 2016, comdog wrote: Show quoted text
> Should the type of exception be X::TypeCheck::Argument? (Found in > src/core/Exception.pm)
Also there's the stackoverflow thread: http://stackoverflow.com/q/40097868/2766176


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org