# New Ticket Created by  Trey Harris 
# Please include the string:  [perl #131262]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=131262 >


Given *RedefErr.pm6*:

use v6.c;
unit class RedefErr;

method foo() { -4; }

method four() { IntStr.new(4, "four"); }

BEGIN { ::?CLASS.^add_method('foo', ::?CLASS.^method_table<four>) };

attempting to use the package gives the following compile-time error:

$ perl --version
This is Rakudo version 2017.03-123-gcb27bce built on MoarVM version
2017.03-87-g5d73bf4
implementing Perl 6.c.
$ perl6 -MRedefErr
===SORRY!=== Error while compiling
/home/trey/src/HandlesBug/lib/RedefErr.pm6 (RedefErr)
An exception occurred while evaluating a BEGIN
at /home/trey/src/HandlesBug/lib/RedefErr.pm6 (RedefErr):8
Exception details:
  ===SORRY!=== Error while compiling
  Package 'RedefErr' already has a method 'foo' (did you mean to
declare a multi-method?)
  at :

$

Note the message completes with at :.

It should give a more useful error message about where the redefinition
actually occurred.
​

Reply via email to