This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldiag: retitle Ambiguous use of %c{%s%s}
authorFather Chrysostomos <sprout@cpan.org>
Mon, 14 Feb 2011 05:56:52 +0000 (21:56 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Mon, 14 Feb 2011 05:56:52 +0000 (21:56 -0800)
This is not very helpful:

=item Ambiguous use of %c{%s%s} resolved to %c%s%s

especially since it is functionally identical to the previous entry:

=item Ambiguous use of %c{%s} resolved to %c%s

Not only can diagnostics.pm never find it, but it is hard for human
beings to understand what the different is at first glance, too.

So filling in the second and fourth %s’s with the two possible values
slays a twain of avians with one piece of petrified matter.

pod/perldiag.pod
toke.c

index 23f6e60..82af202 100644 (file)
@@ -119,7 +119,9 @@ the varable, you can just write C<@foo>.  If you wanted to call the
 function, write C<@{foo()}> ... or you could just not have a variable
 and a function with the same name, and save yourself a lot of trouble.
 
-=item Ambiguous use of %c{%s%s} resolved to %c%s%s
+=item Ambiguous use of %c{%s[...]} resolved to %c%s[...]
+
+=item Ambiguous use of %c{%s{...}} resolved to %c%s{...}
 
 (W ambiguous) You wrote something like C<${foo[2]}> (where foo
 represents the name of a Perl keyword), which might be looking for
diff --git a/toke.c b/toke.c
index 113632e..a2fba3c 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -8702,6 +8702,7 @@ S_scan_ident(pTHX_ register char *s, register const char *send, char *dest, STRL
                    const char * const brack =
                        (const char *)
                        ((*s == '[') ? "[...]" : "{...}");
+   /* diag_listed_as: Ambiguous use of %c{%s[...]} resolved to %c%s[...] */
                    Perl_warner(aTHX_ packWARN(WARN_AMBIGUOUS),
                        "Ambiguous use of %c{%s%s} resolved to %c%s%s",
                        funny, dest, brack, funny, dest, brack);