package tmp;
@.com.redhat.ceylon.compiler.java.metadata.Ceylon(
major = 8,
minor = 1)
@.com.redhat.ceylon.compiler.java.metadata.Method
final class f_ {
private f_() {
}
@.com.redhat.ceylon.common.NonNull
@.com.redhat.ceylon.compiler.java.metadata.TypeInfo("tmp::C")
static .tmp.C f(@.com.redhat.ceylon.compiler.java.metadata.Name("c")
@.com.redhat.ceylon.common.NonNull
@.com.redhat.ceylon.compiler.java.metadata.TypeInfo("tmp::C")
final .tmp.C c) {
return c;
}
}
– which results in a nasty backend and codegen error:
source/tmp/run.ceylon:2: error: Ceylon backend error: cannot find symbol
C f(C c) => c;
^
symbol: class C
location: package tmp
ceylon compile: Fatal error: The compiler exited abnormally (4) due to a bug in the compiler.
Please report it:
https://github.com/ceylon/ceylon/issues/new
Please include:
the stacktrace printed below
a description of what you were trying to compile.
Thank you!
com.redhat.ceylon.compiler.CompilerBugException: Codegen Error
(snip)
Caused by: java.lang.RuntimeException: Error generating bytecode for source/tmp/run.ceylon
at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.genCodeUnlessError(LanguageCompiler.java:836)
(snip)
Caused by: java.lang.AssertionError: typecode ERROR
at com.redhat.ceylon.langtools.tools.javac.jvm.Code.typecode(Code.java:248)
at com.redhat.ceylon.langtools.tools.javac.jvm.Code.width(Code.java:272)
at com.redhat.ceylon.langtools.tools.javac.jvm.Code.width(Code.java:280)
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genMethod(Gen.java:1022)
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.visitMethodDef(Gen.java:996)
at com.redhat.ceylon.langtools.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:777)
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genDef(Gen.java:739)
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genClass(Gen.java:2461)
at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.genCodeUnlessError(LanguageCompiler.java:807)
... 29 more
Most other errors result in some stub being emitted for C, and I think this should happen here too.
I guess this is perhaps because the documentation string is an annotation and not a member of the class? Should doc be special-cased, or would a general better solution be to strip away erroneous annotations but still generate the class?
(Found while refactoring ceylon.ast for ceylon/ceylon.ast#122.)
It seems to me that anytime that an annotation has an error, we can just skip emitting code for the annotation, we don't need to skip the whole declaration.
The compiler doesn’t emit any code for
C
–– which results in a nasty backend and codegen error:
Most other errors result in some stub being emitted for
C
, and I think this should happen here too.I guess this is perhaps because the documentation string is an annotation and not a member of the class? Should
doc
be special-cased, or would a general better solution be to strip away erroneous annotations but still generate the class?(Found while refactoring
ceylon.ast
for ceylon/ceylon.ast#122.)