I'm a little confused by this report. The two code snippets are
exactly the same- I checked with "diff". Does the same code have
different results with different runs, or is there a copy/paste error?
Also is the space between the brackets in "class B{ }" significant
(the other two empty bracket pairs have no space)?

-y



On Tue, Aug 28, 2012 at 2:43 AM, Moritz Lenz <[email protected]>
wrote:
>
> # New Ticket Created by  Moritz Lenz
> # Please include the string:  [perl #114634]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114634 >
>
>
> "Just because it's an A doesn't mean it can't be a B"
>
> Consider
>
> {
>     my class A {};
>     my class B { };
>     my class C is B is A {};
>     multi f(A) { "A" };
>     multi f(B) { "B" };
>     sub g(A $x) { say f($x) };  # type A
>     g(C.new);
> }
>
> # prints A
>
> {
>     my class A {};
>     my class B { };
>     my class C is B is A {};
>     multi f(A) { "A" };
>     multi f(B) { "B" };
>     sub g(A $x) { say f($x) };  # type A
>     g(C.new);
> }
>
> # prints B
>
> and with the optimizer turned off, both print
>
> Ambiguous call to 'f'; these signatures all match:
> :(A )
> :(B )
>
>
> Found by sorear++

Reply via email to