Fixed with a31cc91a0d604a8a74529 .   Tests are still needed

> On 19 Oct 2015, at 03:42, Carsten Hartenfels (via RT) 
> <[email protected]> wrote:
> 
> # New Ticket Created by  Carsten Hartenfels 
> # Please include the string:  [perl #126394]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=126394 >
> 
> 
> This bug is for Rakudo version 2015.09-419-gfae01fb built on MoarVM
> version 2015.09-79-gee9fc2b, according to `perl6 --version`.
> 
> The following code, in `t.pl`:
> 
>    sub s { fail 'important failure message' }
>    my Int $x = s();
>    say $x;
> 
> will output:
> 
>    Type check failed in assignment to $x; expected Int but got Failure
>      in block <unit> at t.pl:2
> 
> But it omits the important failure message, as well as where it was
> actually thrown. Opposed to that, omitting the type:
> 
>    sub s { fail 'important failure message' }
>    my $x = s();
>    say $x;
> 
> will output the much more useful message:
> 
>    important failure message
>      in sub s at t.pl:1
>      in block <unit> at t.pl:2
> 
>    Actually thrown at:
>      in block <unit> at t.pl:3
> 
> This seems to make typed variables much less useful, since they
> potentially eat failure messages every time you assign to them.
> 
> Ideally, the type check message would include the failure information
> too, something like:
> 
>    Type check failed in assignment to $x; expected Int but got Failure
>      important failure message
>        in sub s at t.pl:1
>        in block <unit> at t.pl:2

Reply via email to