ceylon / ceylon-js

DEPRECATED
Apache License 2.0
54 stars 9 forks source link

NPE for member class within dynamic block #501

Closed MadcapJake closed 9 years ago

MadcapJake commented 9 years ago

When attempting this code:

shared void run() {

    dynamic {
        dynamic hapi = require("hapi");
        dynamic server = \iHapi.Server();

        ...
    }

}

, the Server member class of variable \iHapi is annotated with this error in the IDE:

GenerateJsVisitor caused an exception visiting QualifiedTypeExpression node: java.lang.NullPointerException at unknown
chochos commented 9 years ago

This is at compile time? Can't reproduce it, even before the change for #500 this compiles OK.

MadcapJake commented 9 years ago

Yeah I am only seeing this annotated in the IDE. The call to \iHapi is a different reference from the hapi of the previous line and so the Server member class's parent is undefined.

Shouldn't this give a Function or value does not exist: \iHapi or is that not possible in dynamic blocks?

chochos commented 9 years ago

No, in dynamic blocks we let you call undeclared stuff. I suppose what you really need to do is call hapi.\iHapi.Server() but the weird part is that you get an error at compile time, not runtime. The IDE does not have the latest JS compiler so maybe that bug will be gone next time they update the jars.

chochos commented 9 years ago

Is this still an issue?

chochos commented 9 years ago

Can't reproduce; closing.