Community
Participate
Working Groups
+++ This bug was initially created as a clone of Bug #368733 +++ Given the following EGL Source: data Any?; function getData()returns(any) data = null; return (data); end function main() SysLib.writestdout(getData()); end A NVE is not thrown at runtime. NOTE: An NVE is thrown if you change the type of 'data' to a 'String?' and change the return type of 'getData' to 'String' from 'any'.
Defer from 0.8I1 because of vacation
Change the return type of getData() to any? will work. It seems the problem now is that the return type is not validated. Since the return type of getData is non-nullable, we should not allow return a null type.
I disagree with that assessment. The problem is not in the preventing of a null return value, but instead of the usage of that return value itself. The JS generated code is missing a call to egl.checkNull around the function invocation. It should look like this: egl.eglx.lang.SysLib.writeStdout(egl.eglx.lang.EString.ezeCast(egl.checkNull(this.getData()), false)); instead of this original: egl.eglx.lang.SysLib.writeStdout(egl.eglx.lang.EString.ezeCast(this.getData(), false)); The javagen logic has numerous places in the generator that wraps the checkNullable method call around various expressions. JavaScript gen needs to implement those missing ones as well.
fixed