The following code expect a compile error: sys::Float is not assignable to sys::Int
Float f := 3.0f
Int hash := 17
hash += 31 * f
But the error occur in java byte code emit. And didn't tell me which line is wrong.
java.lang.IllegalStateException: Coerce sys::Float => sys::Int
at fanx.emit.FCodeEmit.coerceToPrimitive(FCodeEmit.java:1021)
at fanx.emit.FCodeEmit.coerce(FCodeEmit.java:957)
at fanx.emit.FCodeEmit.emitInstructions(FCodeEmit.java:130)
at fanx.emit.FCodeEmit.emit(FCodeEmit.java:59)
at fanx.emit.FMethodEmit.doEmit(FMethodEmit.java:400)
at fanx.emit.FMethodEmit.emitStandard(FMethodEmit.java:66)
at fanx.emit.FTypeEmit.emit(FTypeEmit.java:184)
at fanx.emit.FTypeEmit.emit(FTypeEmit.java:78)
at fanx.emit.FTypeEmit.emit(FTypeEmit.java:47)
at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:321)
at fan.sys.ClassType.emit(ClassType.java:493)
at fan.sys.ClassType.finish(ClassType.java:547)
at fan.sys.Method$MethodFunc.isStatic(Method.java:475)
at fan.sys.Method$MethodFunc.callList(Method.java:191)
at fan.sys.Type.make(Type.java:246)
at fan.sys.ClassType.make(ClassType.java:110)
at fan.sys.Type.make(Type.java:236)
at fanx.tools.Fan.callMain(Fan.java:175)
at fanx.tools.Fan.executeType(Fan.java:140)
at fanx.tools.Fan.execute(Fan.java:41)
at fanx.tools.Fan.run(Fan.java:298)
at fanx.tools.Fan.main(Fan.java:336)
java.lang.RuntimeException: java.lang.IllegalStateException: Coerce sys::Float => sys::Int
at fan.sys.BootEnv.loadTypeClasses(BootEnv.java:333)
at fan.sys.ClassType.emit(ClassType.java:493)
at fan.sys.ClassType.finish(ClassType.java:547)
at fan.sys.Method$MethodFunc.isStatic(Method.java:475)
at fan.sys.Method$MethodFunc.callList(Method.java:191)
at fan.sys.Type.make(Type.java:246)
at fan.sys.ClassType.make(ClassType.java:110)
at fan.sys.Type.make(Type.java:236)
at fanx.tools.Fan.callMain(Fan.java:175)
at fanx.tools.Fan.executeType(Fan.java:140)
at fanx.tools.Fan.execute(Fan.java:41)
at fanx.tools.Fan.run(Fan.java:298)
at fanx.tools.Fan.main(Fan.java:336)
sys::Err: Cannot emit: myFanTest::Main
at fan.sys.Err.make(Err.java:78)
at fan.sys.Err.make(Err.java:68)
at fan.sys.ClassType.emit(ClassType.java:501)
at fan.sys.ClassType.finish(ClassType.java:547)
at fan.sys.Method$MethodFunc.isStatic(Method.java:475)
at fan.sys.Method$MethodFunc.callList(Method.java:191)
at fan.sys.Type.make(Type.java:246)
at fan.sys.ClassType.make(ClassType.java:110)
at fan.sys.Type.make(Type.java:236)
at fanx.tools.Fan.callMain(Fan.java:175)
at fanx.tools.Fan.executeType(Fan.java:140)
at fanx.tools.Fan.execute(Fan.java:41)
at fanx.tools.Fan.run(Fan.java:298)
at fanx.tools.Fan.main(Fan.java:336)
sys::Err: Method not mapped to java.lang.reflect correctly myFanTest::Main.make
fan.sys.Method$MethodFunc.isStatic (Method.java:482)
fan.sys.Method$MethodFunc.callList (Method.java:191)
fan.sys.Type.make (Type.java:246)
fan.sys.ClassType.make (ClassType.java:110)
fan.sys.Type.make (Type.java:236)
fanx.tools.Fan.callMain (Fan.java:175)
fanx.tools.Fan.executeType (Fan.java:140)
fanx.tools.Fan.execute (Fan.java:41)
fanx.tools.Fan.run (Fan.java:298)
fanx.tools.Fan.main (Fan.java:336)
brianSun 20 Dec 2015
Ticket promoted to #2499 and assigned to brian
We added support to implicitly coerce b/w Float and Int, but looks like the special math/assignment combos aren't working correctly in the fcode they emit.
brianWed 4 Oct 2017
Ticket resolved in 1.0.70
Looks like this changeset from earlier this year resolved this issue
go4 Sun 20 Dec 2015
The following code expect a compile error:
sys::Float
is not assignable tosys::Int
But the error occur in java byte code emit. And didn't tell me which line is wrong.
brian Sun 20 Dec 2015
Ticket promoted to #2499 and assigned to brian
We added support to implicitly coerce b/w Float and Int, but looks like the special math/assignment combos aren't working correctly in the fcode they emit.
brian Wed 4 Oct 2017
Ticket resolved in 1.0.70
Looks like this changeset from earlier this year resolved this issue