#1307 VerifyError with as/+ operator combo

tonsky Thu 11 Nov 2010

I'm very proud to have found the very first bug in 1.0.56

>>> Obj x := 1
>>> 1 + (x as Int)
ERROR(1): No operator method found: sys::Int + sys::Int
>>> x + 1
ERROR(1): No operator method found: sys::Obj + sys::Int
>>> 1 + x
ERROR(1): Ambiguous operator method: sys::Int + sys::Obj (plus, plusFloat, plusDecimal)
>>> (x as Int)+1
java.lang.VerifyError: (class: fan/sh17/FanshEval, method: _eval signature: ()Ljava/lang/Object;) Expecting to find long on stack
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
	at java.lang.Class.getDeclaredFields(Class.java:1743)
	at fan.sys.ClassType.finishSlots(ClassType.java:581)
	at fan.sys.ClassType.finish(ClassType.java:544)
	at fan.sys.Method$MethodFunc.isStatic(Method.java:459)
	at fan.sys.Method$MethodFunc.callList(Method.java:175)
	at fan.sys.Type.make(Type.java:245)
	at fan.sys.ClassType.make(ClassType.java:110)
	at fan.fansh.Evaluator.eval(Evaluator.fan:111)
	at fan.fansh.Shell.run(Shell.fan:46)
	at fan.fansh.Main.main(Shell.fan:202)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at fan.sys.Method.invoke(Method.java:536)
	at fan.sys.Method$MethodFunc.callList(Method.java:182)
	at fan.sys.Method.callList(Method.java:147)
	at fanx.tools.Fan.callMain(Fan.java:135)
	at fanx.tools.Fan.executeType(Fan.java:102)
	at fanx.tools.Fan.execute(Fan.java:38)
	at fanx.tools.Fan.run(Fan.java:236)
	at fanx.tools.Fan.main(Fan.java:274)
sys::Err: Method not mapped to java.lang.reflect correctly sh17::FanshEval.make
  fan.sys.Method$MethodFunc.isStatic (Method.java:466)
  fan.sys.Method$MethodFunc.callList (Method.java:175)
  fan.sys.Type.make (Type.java:245)
  fan.sys.ClassType.make (ClassType.java:110)
  fansh::Evaluator.eval (Evaluator.fan:111)
  fansh::Shell.run (Shell.fan:46)
  fansh::Main.main (Shell.fan:202)
  java.lang.reflect.Method.invoke (Method.java:597)
  fan.sys.Method.invoke (Method.java:536)
  fan.sys.Method$MethodFunc.callList (Method.java:182)
  fan.sys.Method.callList (Method.java:147)
  fanx.tools.Fan.callMain (Fan.java:135)
  fanx.tools.Fan.executeType (Fan.java:102)
  fanx.tools.Fan.execute (Fan.java:38)
  fanx.tools.Fan.run (Fan.java:236)
  fanx.tools.Fan.main (Fan.java:274)

brian Thu 11 Nov 2010

Promoted to ticket #1307 and assigned to brian

Actually looks like that bug isn't related to new changes - its been there.

brian Thu 11 Nov 2010

Renamed from First bug in 1.0.56 :) to VerifyError with as/+ operator combo

brian Mon 3 Jan 2011

Ticket resolved in 1.0.56

Two problems here actually, both related to how Fantom compiler treats "always nullable" expressions like as operator:

  1. case 1 + (x as Int) error message should have included nullability
  2. case (x as Int)+1 the error message was being incorrectly suppressed

Both cases should now report meaningful errors; you can't use an expression like ?. or as which is guaranteed to return null where a non-nullable is expected.

brian Mon 3 Jan 2011

Ticket reopened

brian Mon 3 Jan 2011

Ticket resolved in 1.0.57

Login or Signup to reply.