"backend error: cannot find symbol" and CompilerBugException on reference to method-object parameter in inline anonymous function passed to superclass parameter
See original GitHub issueThis code:
class Inner(Anything(Integer) arg) {}
class Outer(Anything() arg) extends Inner((num) => arg()) {
}
void temp() { }
void mwe() {
Outer(temp);
}
when compiled with the command-line tools (“ceylon version 1.3.1 74ea8c7 (Now We Try It My Way)”, installed on Mac OS X Sierra via Homebrew) causes the compiler to error out with a “Ceylon backend error” and throw a CompilerBugException:
source/mwe/callable_constructors.ceylon:2: error: Ceylon backend error: cannot find symbol
class Outer(Anything() arg) extends Inner((num) => arg()) {
^
symbol: method arg()
Note: Created module mwe/0.0.1
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: Bug
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:497)
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:497)
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.ClassCastException: com.redhat.ceylon.langtools.tools.javac.code.Symbol$ClassSymbol cannot be cast to com.redhat.ceylon.langtools.tools.javac.code.Symbol$MethodSymbol
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.visitApply(Gen.java:1847)
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.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.ceylon.langtools.tools.javac.jvm.Gen.genStat(Gen.java:760)
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.genStats(Gen.java:811)
at com.redhat.ceylon.langtools.tools.javac.jvm.Gen.visitBlock(Gen.java:1159)
at com.redhat.ceylon.langtools.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:908)
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.ceylon.langtools.tools.javac.jvm.Gen.genMethod(Gen.java:1033)
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)
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
OTOH, neither ceylon compile-js
nor the IntelliJ plugin reports any error.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
ember/no-incorrect-calls-with-inline-anonymous-functions
When an inline function is passed as an argument, the function reference will be different each time. Rule Details. This rule disallows using...
Read more >C# Cannot use ref or out parameter inside an anonymous ...
However my first attempt is giving me an error "cannot use ref or out parameter inside an anonymous method body". public static class...
Read more >Anonymous Functions - HHVM and Hack Documentation
To create an anonymous function with more than one parameter, surround the parameter list with ... Anonymous functions pass by value, not by...
Read more >Fixing cannot find symbol in Java - YouTube
Common fixes for cannot find symbol in Java. This typically means a misspelling, variable or method that does not exist, or variable that...
Read more >Anonymous Functions - MATLAB & Simulink - MathWorks
An anonymous function is a single inline executable expression that returns one output.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe. I’ll take a look tomorrow.
Great!