Ticket #1345
Here's the source:
class A { @Operator A plus(A that) { return A() } static Void main() { x := B() x += A() x.doNothing } } class B : A { Void doNothing() { } }
If you try to run it. You'll get java.lang.VerifyError because x += A() doesn't add coerce. From fanp -c -f test.fan A.main:
java.lang.VerifyError
x += A()
fanp -c -f test.fan A.main
12: CallVirtual script::A.plus(script::A) -> script::A 15: StoreVar 0
If I change problematic line to x = x + A() it will become:
x = x + A()
12: CallVirtual script::A.plus(script::A) -> script::A 15: Coerce script::A => script::B 20: StoreVar 0
and code will fail with sys::CastErr as expected.
sys::CastErr
Promoted to ticket #1345 and assigned to brian
Ticket resolved in 1.0.57
changeset
Login or Signup to reply.
vkuzkokov Wed 1 Dec 2010
Here's the source:
If you try to run it. You'll get
java.lang.VerifyError
becausex += A()
doesn't add coerce. Fromfanp -c -f test.fan A.main
:If I change problematic line to
x = x + A()
it will become:and code will fail with
sys::CastErr
as expected.brian Wed 1 Dec 2010
Promoted to ticket #1345 and assigned to brian
brian Mon 3 Jan 2011
Ticket resolved in 1.0.57
changeset