ceylon/ceylon-compiler — Issue #251: NPE for unknown member
Author: gavinking
Created: 2011-12-01 04:54:37+00:00
State: open
Labels: BUG, high priority

for the following code:

String[] result = ...
assert(result.lastIndex==1, "sequence last index");

The compiler craps out with an NPE.

The code is incorrect (`String[]` doesn't have

[ceylonc] /Users/gavin/ceylon.language/test/sequences.ceylon:13: compiler message file broken: key=compiler.err.ceylon arguments=Compiler error: java.lang.NullPointerException, {1}, {2}, {3}, {4}, {5}, {6}, {7}
[ceylonc] assert(result.lastIndex==1, "sequence last index");
[ceylonc] ^
[ceylonc] java.lang.NullPointerException
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transform(ExpressionTransformer.java:1030)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.CeylonVisitor.visit(CeylonVisitor.java:271)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$QualifiedMemberExpression.visit(Tree.java:4745)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transformExpression(ExpressionTransformer.java:122)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transform(ExpressionTransformer.java:461)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.CeylonVisitor.visit(CeylonVisitor.java:345)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:157)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Visitor.visit(Visitor.java:158)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$EqualOp.visit(Tree.java:3743)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkExpression(Walker.java:944)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$Expression.visitChildren(Tree.java:4465)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transformExpression(ExpressionTransformer.java:120)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transformArg(ExpressionTransformer.java:975)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transformPositionalInvocation(ExpressionTransformer.java:937)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transform(ExpressionTransformer.java:549)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.CeylonVisitor.visit(CeylonVisitor.java:267)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$InvocationExpression.visit(Tree.java:4540)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkExpression(Walker.java:944)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$Expression.visitChildren(Tree.java:4465)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ExpressionTransformer.transformExpression(ExpressionTransformer.java:120)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.CeylonVisitor.visit(CeylonVisitor.java:258)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$ExpressionStatement.visit(Tree.java:2036)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.StatementTransformer.transformStmts(StatementTransformer.java:90)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.StatementTransformer.transform(StatementTransformer.java:82)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ClassTransformer.transform(ClassTransformer.java:319)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.ClassTransformer.transformWrappedMethod(ClassTransformer.java:276)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.CeylonVisitor.visit(CeylonVisitor.java:158)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$MethodDefinition.visit(Tree.java:979)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Walker.walkCompilationUnit(Walker.java:13)
[ceylonc]	at com.redhat.ceylon.compiler.typechecker.tree.Tree$CompilationUnit.visitChildren(Tree.java:30)
[ceylonc]	at com.redhat.ceylon.compiler.codegen.CeylonTransformer.transformAfterTypeChecking(CeylonTransformer.java:116)
[ceylonc]	at com.redhat.ceylon.compiler.loader.CeylonEnter.completeCeylonTrees(CeylonEnter.java:167)
[ceylonc]	at com.redhat.ceylon.compiler.loader.CeylonEnter.main(CeylonEnter.java:114)
[ceylonc]	at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:905)
[ceylonc]	at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:805)
[ceylonc]	at com.redhat.ceylon.compiler.launcher.Main.compile(Main.java:392)
[ceylonc]	at com.redhat.ceylon.compiler.launcher.Main.compile(Main.java:327)
[ceylonc]	at com.redhat.ceylon.compiler.launcher.Main.compile(Main.java:317)
[ceylonc]	at com.redhat.ceylon.compiler.Main.compile(Main.java:50)
[ceylonc]	at com.redhat.ceylon.compiler.Main.main(Main.java:69)