ceylon/ceylon-compiler — Issue #327: Enumerated types
Author: gavinking
Created: 2012-01-20 00:12:53+00:00
State: open
Labels: BUG, high priority

In `FooBar.ceylon`:

class FooBar() of foo | bar {}

In `test.ceylon`:

object foo extends FooBar() {}
object bar extends FooBar() {}

void test() {
FooBar fb = foo;
switch (fb)
case (foo) { print("foo"); }
case (bar) { print("bar"); }
}

The following error results:

Note: compiler message file broken: key=compiler.note.ceylon arguments=Ceylon repository 'http://modules.ceylon-lang.org' not yet available., {1}, {2}, {3}, {4}, {5}, {6}, {7}
An exception has occurred in the compiler (ceylonc 0.1 'Newton').
java.lang.AssertionError: typecode 19
at com.sun.tools.javac.jvm.Code.typecode(Code.java:245)
at com.sun.tools.javac.jvm.Items$Item.coerce(Items.java:264)
at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:834)
at com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1626)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1145)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:679)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:714)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:700)
at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:751)
at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1027)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:768)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:679)
at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:714)
at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:907)
at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:880)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:656)
at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:679)
at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2221)
at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.genCodeUnlessError(LanguageCompiler.java:468)
at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.genCode(LanguageCompiler.java:446)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1381)
at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1349)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:851)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:810)
at com.redhat.ceylon.compiler.java.launcher.Main.compile(Main.java:457)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
at com.redhat.ceylon.eclipse.imp.builder.CeylonBuilder.generateBinaries(CeylonBuilder.java:882)
at com.redhat.ceylon.eclipse.imp.builder.CeylonBuilder.build(CeylonBuilder.java:578)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:728)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:199)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:239)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:292)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:295)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:351)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:374)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Tom, was this supposed to be working, or not yet?