eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
399 stars 62 forks source link

Compiler bug #6745

Open MikhailMalyutin opened 7 years ago

MikhailMalyutin commented 7 years ago
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 at com.redhat.ceylon.compiler.CeylonCompileTool.handleExitCode(CeylonCompileTool.java:929) at com.redhat.ceylon.compiler.CeylonCompileTool.run(CeylonCompileTool.java:911) at com.redhat.ceylon.common.tools.CeylonTool.run(CeylonTool.java:547) at com.redhat.ceylon.common.tools.CeylonTool.execute(CeylonTool.java:423) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.redhat.ceylon.launcher.Launcher.runInJava7Checked(Launcher.java:108) at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:38) at com.redhat.ceylon.launcher.Launcher.run(Launcher.java:31) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.redhat.ceylon.launcher.Bootstrap.runVersion(Bootstrap.java:162) at com.redhat.ceylon.launcher.Bootstrap.runInternal(Bootstrap.java:117) at com.redhat.ceylon.launcher.Bootstrap.run(Bootstrap.java:93) at com.redhat.ceylon.launcher.Bootstrap.main(Bootstrap.java:85) Caused by: java.lang.RuntimeException: Error generating bytecode for source/ru/dellin/analizer/core/api/api.ceylon at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.genCodeUnlessError(LanguageCompiler.java:836) at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.genCode(LanguageCompiler.java:773) at com.redhat.ceylon.langtools.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1575) at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.generate(LanguageCompiler.java:946) at com.redhat.ceylon.langtools.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1539) at com.redhat.ceylon.langtools.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:904) at com.redhat.ceylon.langtools.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:862) at com.redhat.ceylon.compiler.java.tools.LanguageCompiler.compile(LanguageCompiler.java:272) at com.redhat.ceylon.compiler.java.launcher.Main.compile(Main.java:658) at com.redhat.ceylon.compiler.java.launcher.Main.compile(Main.java:564) at com.redhat.ceylon.compiler.java.launcher.Main.compile(Main.java:556) at com.redhat.ceylon.compiler.java.launcher.Main.compile(Main.java:545) at com.redhat.ceylon.compiler.CeylonCompileTool.run(CeylonCompileTool.java:910) ... 17 more 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.Items$Item.coerce(Items.java:269) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genExpr(Gen.java:951) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.visitSelect(Gen.java:2345) at com.redhat.ceylon.langtools.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1896) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genExpr(Gen.java:949) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.visitApply(Gen.java:1843) at com.redhat.ceylon.langtools.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1464) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genExpr(Gen.java:949) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.visitReturn(Gen.java:1809) at com.redhat.ceylon.langtools.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1383) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genDef(Gen.java:739) at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genStat(Gen.java:774) at com.redhat.ce

Happens after patch:

Index: source/ru/dellin/analizer/core/api/api.ceylon
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- source/ru/dellin/analizer/core/api/api.ceylon   (revision a19dc7b0dcef8356dc0144da1a2704181c65a564)
+++ source/ru/dellin/analizer/core/api/api.ceylon   (revision )
@@ -34,7 +34,6 @@
 import java.util.\ifunction {
     Consumer,
     IntConsumer,
-    Function,
     BiFunction,
     ToIntBiFunction,
     ToDoubleFunction,
@@ -52,7 +51,6 @@
 import ru.dellin.analizer.core.utils {
     syncGetRes,
     toJavaCallable,
-    toJavaFunc,
     toJavaConsumer,
     calculateHashArraySize,
     unpack,
@@ -450,7 +448,7 @@
                 return;
             }
             value key = groups.map((e) => e(element)).sequence();
-            List<T> found = groupMap.computeIfAbsent(key, toJavaFunc<[Object*],List<T>>( (key) => Collections.synchronizedList(JArrayList<T>())));
+            List<T> found = groupMap.computeIfAbsent(key, (key) => Collections.synchronizedList(JArrayList<T>()));
             found.add(element);
         }

@@ -663,7 +661,7 @@
     }
     ObjectArray<DoubleAccumulator>  accumulator = createEmpty(); //DoubleAccumulator(toDoubleBinaryOperator(agFunc), initialValue);

-    Function<GroupKey,ObjectArray<DoubleAccumulator> > addFirstFunc = toJavaFunc<GroupKey,ObjectArray<DoubleAccumulator>>((key) => createEmpty());
+    value addFirstFunc = (GroupKey key) => createEmpty();
     ObjectArray<Integer->Float(Integer)> indexed = createJavaObjectArray(aggregators.indexed.map((i -> [_, f]) => i-> f));

     shared JMap<GroupKey,ObjectArray<DoubleAccumulator>> getGroupMap() {
FroMage commented 7 years ago

Could you give us a standalone code example to reproduce?