Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler dump stack trace when add native overloaded function to an array. #274

Open
shibukawa opened this issue Oct 3, 2013 · 0 comments
Labels

Comments

@shibukawa
Copy link
Contributor

Source:

native class Native {
    static function print(arg : string) : void;
    static function print(arg : number) : void;
}

class _Main
{
    static function main(argv : string[]) : void
    {
        var a = [1, "hello", Native.print];
        // var a = [1, "hello", Native.print as (string) -> void]; is OK
    }
}

Result:

$ jsx test.jsx
[test.jsx:10:12] Warning: unused variable a
        var a = [1, "hello", Native.print];
            ^


/opt/local/lib/node_modules/jsx/bin/jsx:4346
                    throw new Error("[src/jsemitter.jsx:2046:98] detected invalid cast, value
                          ^
Error: [src/jsemitter.jsx:2046:98] detected invalid cast, value is not an instance of the designated type or null
                name = this._emitter.getNamer().getNameOfStaticFunction(classDef, name, (exprType as ResolvedFunctionType).getArgumentTypes());
                                                                                                  ^^

    at /opt/local/lib/node_modules/jsx/bin/jsx:4346:12
    at Object._PropertyExpressionEmitter._emit$ (/opt/local/lib/node_modules/jsx/bin/jsx:4349:5)
    at /opt/local/lib/node_modules/jsx/bin/jsx:4158:9
    at Object._ExpressionEmitter.emitWithPrecedence$NNF$V$ (/opt/local/lib/node_modules/jsx/bin/jsx:3537:3)
    at Object._OperatorExpressionEmitter.emit$N (/opt/local/lib/node_modules/jsx/bin/jsx:4157:7)
    at Object._ArrayLiteralExpressionEmitter.emit$N (/opt/local/lib/node_modules/jsx/bin/jsx:3667:65)
    at Object.JavaScriptEmitter._emitWithNullableGuard$LExpression$N (/opt/local/lib/node_modules/jsx/bin/jsx:12425:52)
    at Object.JavaScriptEmitter._emitRHSOfAssignment$LExpression$LType$ (/opt/local/lib/node_modules/jsx/bin/jsx:12488:8)
    at Object._AssignmentExpressionEmitter._emit$ (/opt/local/lib/node_modules/jsx/bin/jsx:4470:16)
    at /opt/local/lib/node_modules/jsx/bin/jsx:4158:9
gfx added a commit that referenced this issue Oct 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant