ceylon / ceylon-js

DEPRECATED
Apache License 2.0
54 stars 9 forks source link

Error passing return value of a generic function to generic callable #487

Closed jvasileff closed 9 years ago

jvasileff commented 9 years ago

Somehow the value for the parameter i to op doesn't think it's an Integer:

shared void noMethod() {
    exec {
        op = (Integer i) => i.times(2);
        argFactory = () => [1];
    };
}

void exec<Args>(op, argFactory) 
        given Args satisfies Anything[] {
    Anything(*Args) op;
    Args() argFactory;
    print(op(*argFactory()));
}

produces:

/.../sandbox.ceylon.snapjs.base-0.0.1.js:145
        return $t1j.times(2);
                    ^
TypeError: Object [object Object] has no method 'times'
    at $t1i (/.../0.0.1/sandbox.ceylon.snapjs.base-0.0.1.js:145:21)
    at exec (/.../0.0.1/sandbox.ceylon.snapjs.base-0.0.1.js:162:17)
    at noMethod (/.../0.0.1/sandbox.ceylon.snapjs.base-0.0.1.js:148:8)
    at [eval]:1:352
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:456:26)
    at evalScript (node.js:536:25)
    at startup (node.js:80:7)
    at node.js:906:3
chochos commented 9 years ago

ok this only happens with named-args call. Looks like something to do with boxing is missing in named-args calls.