From: Rafael Garcia-Suarez Date: Tue, 9 Mar 2004 20:29:02 +0000 (+0000) Subject: Improve the "Prototype mismatch" error message when X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ebe643b992508010c797fcd5c6ecf4d399139555;p=p5sagit%2Fp5-mst-13.2.git Improve the "Prototype mismatch" error message when the redefined subroutine didn't have any prototype. p4raw-id: //depot/perl@22474 --- diff --git a/op.c b/op.c index ca24417..b695a63 100644 --- 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); diff --git a/t/comp/redef.t b/t/comp/redef.t index 328b44d..63be16c 100755 --- a/t/comp/redef.t +++ b/t/comp/redef.t @@ -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 }