eclipse-archived/ceylon

NPE in JS backend

Opened this issue · 2 comments

Given:

Callable<String,[String]|[Integer, Integer]> fun
        = flatten(([String]|[Integer, Integer] _)
=> switch (_)
case ([String s]) s
case ([Integer i, Integer j]) i.string.repeat(j));

String s = fun("");
String w = fun(1, 2);

I get:

Error:(66, 20) ceylon: the 'GenerateJsVisitor' caused an exception visiting a 'InvocationExpression' node: '"java.lang.NullPointerException"' at 'com.redhat.ceylon.compiler.js.InvocationGenerator.generatePositionalArguments(InvocationGenerator.java:413)'

It says w has no type... strange.

NPE is gone, but the program now breaks at runtime, because the function receives the tuple instead of the args inside it.