Skip to content
Permalink
Browse files

Add the definition of arguments in Multi::NoMatch exception

Add a U or D if the parameter is defined or not. This make easier to notice a mismatch because of that, eg you pass an undef value when a defined value is expected.
fix #2494

EG :
`perl6 -e 'my buf8 $foo; $foo.append("foo".encode("latin1"));'`
Cannot resolve caller append(Buf[uint8]: Blob[uint8]); none of these signatures match:
    (Buf:D $: int $got, *%_)
    (Buf:D $: Int:D $got, *%_)
    (Buf:D $: Mu:D $got, *%_)
    (Buf:D $: Blob:D $buf, *%_)
    (Buf:D $: int @values, *%_)
    (Buf:D $: @values, *%_)
    (Buf:D $: *@values, *%_)

Became
Cannot resolve caller append(Buf[uint8]:U: Blob[uint8]:D); none of these signatures match:
    (Buf:D: int $got, *%_)
    (Buf:D: Int:D $got, *%_)
    (Buf:D: Mu:D $got, *%_)
    (Buf:D: Blob:D $buf, *%_)
    (Buf:D: int @values, *%_)
    (Buf:D: @values, *%_)
    (Buf:D: *@values, *%_)
  • Loading branch information...
Skarsnik committed Nov 19, 2018
1 parent 7262b4e commit 869b9e5813ea0ddd495ea637dd17f88e77b500f3
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/core/Exception.pm6
@@ -2630,7 +2630,7 @@ my class X::Multi::NoMatch is Exception {
if $.capture {
for $.capture.list {
try @bits.push(
$where ?? Rakudo::Internals.SHORT-GIST($_) !! .WHAT.perl
$where ?? Rakudo::Internals.SHORT-GIST($_) !! .WHAT.perl ~ ':' ~ (.defined ?? "D" !! "U")
);
@bits.push($_.^name) if $!;
when Failure {
@@ -2647,8 +2647,8 @@ my class X::Multi::NoMatch is Exception {
else {
try @bits.push(":$(.key)\($($where
?? Rakudo::Internals.SHORT-GIST: .value
!! .value.WHAT.?perl
))");
!! .value.WHAT.?perl):$(.value.defined ?? "D" !! "U")
)");
@bits.push(':' ~ .value.^name) if $!;
}
}

0 comments on commit 869b9e5

Please sign in to comment.
You can’t perform that action at this time.