Aladdin - Scala Bugtracking
[#227] project: compiler priority: medium category: bug
submitter assigned to status date submitted
Erik Martin fixed 2003-11-18 12:57:37.0
subject Anonymous function of arity 10 crashes compiler
code
class Anon() {
  val b = (a:int,b:int,c:int,d:int,e:int,f:int,g:int,h:int,i:int,j:int) => a+i;
}
what happened
Exception in thread "main" java.lang.AssertionError: 10
        at scalac.symtab.Definitions.FUNCTION_TYPE(Definitions.java:153)
        at scalac.ast.TreeGen.mkFunction(TreeGen.java:1042)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:2245)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1819)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1834)
        at scalac.typechecker.Analyzer.defineSym(Analyzer.java:1072)
        at scalac.typechecker.Analyzer$LazyTreeType.complete(Analyzer.java:642)
        at scalac.symtab.Symbol.info(Symbol.java:809)
        at scalac.symtab.Symbol.initialize(Symbol.java:773)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1867)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1838)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1639)
        at scalac.typechecker.Analyzer.transformTemplate(Analyzer.java:1698)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1906)
        at scalac.typechecker.Analyzer.transform(Analyzer.java:1838)
        at scalac.typechecker.Analyzer.transformStatSeq(Analyzer.java:1639)
        at scalac.typechecker.Analyzer.apply(Analyzer.java:113)
        at scalac.ast.Transformer.apply(Transformer.java:62)
        at scalac.typechecker.Analyzer.apply(Analyzer.java:61)
        at scalac.typechecker.AnalyzerPhase.apply(AnalyzerPhase.java:66)
        at scalac.Global.compile(Global.java:300)
        at scalac.Global.compile(Global.java:272)
        at scalac.Main.main(Main.java:32)
what expected I know that anonymous functions are implemented by the traits Function0 to Function9 and that there (curently) might be some limitation in the compiler as to the use of anonymous functions with an arity greater than 9. If there is a limitation I would expect a nice error message, not a compiler crash.
[back to overview]
Changes of this bug report
Martin  edited on  2004-01-05 17:59:22.0