This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Improve the "Prototype mismatch" error message when
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 9 Mar 2004 20:29:02 +0000 (20:29 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 9 Mar 2004 20:29:02 +0000 (20:29 +0000)
the redefined subroutine didn't have any prototype.

p4raw-id: //depot/perl@22474

op.c
t/comp/redef.t

diff --git a/op.c b/op.c
index ca24417..b695a63 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3911,6 +3911,8 @@ Perl_cv_ckproto(pTHX_ CV *cv, GV *gv, char *p)
            Perl_sv_catpvf(aTHX_ msg, " sub %"SVf, name);
        if (SvPOK(cv))
            Perl_sv_catpvf(aTHX_ msg, " (%"SVf")", (SV *)cv);
+       else
+           Perl_sv_catpvf(aTHX_ msg, ": none");
        sv_catpv(msg, " vs ");
        if (p)
            Perl_sv_catpvf(aTHX_ msg, "(%s)", p);
index 328b44d..63be16c 100755 (executable)
@@ -23,13 +23,13 @@ ok 1, $warn =~ s/Subroutine sub0 redefined[^\n]+\n//s;
 sub sub1    { 1 }
 sub sub1 () { 2 }
 
-ok 2, $warn =~ s/$NEWPROTO \Qsub main::sub1 vs ()\E[^\n]+\n//s;
+ok 2, $warn =~ s/$NEWPROTO \Qsub main::sub1: none vs ()\E[^\n]+\n//s;
 ok 3, $warn =~ s/Subroutine sub1 redefined[^\n]+\n//s;
 
 sub sub2     { 1 }
 sub sub2 ($) { 2 }
 
-ok 4, $warn =~ s/$NEWPROTO \Qsub main::sub2 vs ($)\E[^\n]+\n//s;
+ok 4, $warn =~ s/$NEWPROTO \Qsub main::sub2: none vs ($)\E[^\n]+\n//s;
 ok 5, $warn =~ s/Subroutine sub2 redefined[^\n]+\n//s;
 
 sub sub3 () { 1 }