Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambdas with more than 22 parameters crash the compiler. #1384

Closed
nicolasstucki opened this issue Jul 13, 2016 · 2 comments
Closed

Lambdas with more than 22 parameters crash the compiler. #1384

nicolasstucki opened this issue Jul 13, 2016 · 2 comments

Comments

@nicolasstucki
Copy link
Contributor

dotty> val f = (a1: Int, a2: Int, a3: Int, a4: Int, a5: Int, a6: Int, a7: Int, a8: Int, a9: Int, 
  a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, 
  a19: Int, a20: Int, a21: Int, a22: Int, a23: Int) => ???
[error] (run-main-0) java.lang.ArrayIndexOutOfBoundsException: 23
java.lang.ArrayIndexOutOfBoundsException: 23
    at dotty.tools.dotc.core.Definitions$FunctionOf$.apply(Definitions.scala:537)
    at dotty.tools.dotc.core.Types$Type.toFunctionType(Types.scala:1179)
    at dotty.tools.dotc.typer.TypeAssigner$class.assignType(TypeAssigner.scala:374)
    at dotty.tools.dotc.typer.Typer.assignType(Typer.scala:60)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClosure$1.apply(Typer.scala:714)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClosure$1.apply(Typer.scala:693)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedClosure(Typer.scala:693)
    at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1274)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1304)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1351)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedBlock$1.apply(Typer.scala:520)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedBlock$1.apply(Typer.scala:517)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:517)
    at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1271)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1304)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedFunction$1.apply(Typer.scala:689)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedFunction$1.apply(Typer.scala:583)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedFunction(Typer.scala:583)
    at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1273)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1304)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Namer.typedAheadImpl(Namer.scala:721)
    at dotty.tools.dotc.typer.Namer.typedAheadExpr(Namer.scala:731)
    at dotty.tools.dotc.typer.Namer.rhsType$1(Namer.scala:845)
    at dotty.tools.dotc.typer.Namer.cookedRhsType$1(Namer.scala:846)
    at dotty.tools.dotc.typer.Namer.lhsType$lzycompute$1(Namer.scala:847)
    at dotty.tools.dotc.typer.Namer.lhsType$1(Namer.scala:847)
    at dotty.tools.dotc.typer.Namer.inferredType$1(Namer.scala:859)
    at dotty.tools.dotc.typer.Namer.valOrDefDefSig(Namer.scala:867)
    at dotty.tools.dotc.typer.Namer$Completer.typeSig(Namer.scala:504)
    at dotty.tools.dotc.typer.Namer$Completer.completeInCreationContext(Namer.scala:548)
    at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:530)
    at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:209)
    at dotty.tools.dotc.core.SymDenotations$SymDenotation.info(SymDenotations.scala:187)
    at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:311)
    at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:1215)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1240)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1302)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1336)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1347)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1089)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1072)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1072)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1254)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1302)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1336)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1347)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1089)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1072)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1072)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1254)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1302)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1336)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1347)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1089)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedClassDef$1.apply(Typer.scala:1072)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:1072)
    at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:1254)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1302)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:1336)
    at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:1347)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1179)
    at dotty.tools.dotc.typer.Typer$$anonfun$typedPackageDef$1.apply(Typer.scala:1170)
    at dotty.tools.dotc.util.Stats$.track(Stats.scala:36)
    at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:1170)
    at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:1292)
    at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:1304)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1314)
    at dotty.tools.dotc.typer.Typer$$anonfun$typed$2.apply(Typer.scala:1312)
    at dotty.tools.dotc.reporting.Reporting$class.traceIndented(Reporter.scala:131)
    at dotty.tools.dotc.core.Contexts$Context.traceIndented(Contexts.scala:55)
    at dotty.tools.dotc.typer.Typer.typed(Typer.scala:1312)
    at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:1351)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$typeCheck$1.apply$mcV$sp(FrontEnd.scala:47)
    at dotty.tools.dotc.typer.FrontEnd.monitor(FrontEnd.scala:23)
    at dotty.tools.dotc.typer.FrontEnd.typeCheck(FrontEnd.scala:45)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:69)
    at dotty.tools.dotc.typer.FrontEnd$$anonfun$runOn$3.apply(FrontEnd.scala:69)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at dotty.tools.dotc.typer.FrontEnd.runOn(FrontEnd.scala:69)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:62)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1$$anonfun$apply$mcV$sp$1.apply(Run.scala:59)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply$mcV$sp(Run.scala:59)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:54)
    at dotty.tools.dotc.Run$$anonfun$compileUnits$1.apply(Run.scala:54)
    at dotty.tools.dotc.util.Stats$.monitorHeartBeat(Stats.scala:69)
    at dotty.tools.dotc.Run.compileUnits(Run.scala:54)
    at dotty.tools.dotc.Run.compileSources(Run.scala:51)
    at dotty.tools.dotc.repl.CompilingInterpreter.compileSources(CompilingInterpreter.scala:195)
    at dotty.tools.dotc.repl.CompilingInterpreter$Request.compile(CompilingInterpreter.scala:397)
    at dotty.tools.dotc.repl.CompilingInterpreter.interpret(CompilingInterpreter.scala:218)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$2.apply(AmmoniteReader.scala:19)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$2.apply(AmmoniteReader.scala:19)
    at dotty.tools.dotc.repl.CompilingInterpreter.delayOutputDuring(CompilingInterpreter.scala:103)
    at dotty.tools.dotc.repl.AmmoniteReader.incompleteInput(AmmoniteReader.scala:19)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$1.applyOrElse(AmmoniteReader.scala:31)
    at dotty.tools.dotc.repl.AmmoniteReader$$anonfun$1.applyOrElse(AmmoniteReader.scala:29)
    at scala.PartialFunction$Lifted.apply(PartialFunction.scala:223)
    at scala.PartialFunction$Lifted.apply(PartialFunction.scala:219)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1$$anonfun$apply$1.apply(Filter.scala:21)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1$$anonfun$apply$1.apply(Filter.scala:21)
    at scala.collection.Iterator$$anon$11.next(Iterator.scala:370)
    at scala.collection.Iterator$class.find(Iterator.scala:802)
    at scala.collection.AbstractIterator.find(Iterator.scala:1202)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1.apply(Filter.scala:21)
    at dotty.tools.dotc.repl.ammonite.terminal.Filter$$anon$1$$anonfun$1.apply(Filter.scala:21)
    at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readChar$1(Terminal.scala:267)
    at dotty.tools.dotc.repl.ammonite.terminal.Terminal$.readLine(Terminal.scala:299)
    at dotty.tools.dotc.repl.AmmoniteReader.readLine(AmmoniteReader.scala:54)
    at dotty.tools.dotc.repl.InterpreterLoop.repl$default$1(InterpreterLoop.scala:74)
    at dotty.tools.dotc.repl.InterpreterLoop.repl(InterpreterLoop.scala:80)
    at dotty.tools.dotc.repl.InterpreterLoop.run(InterpreterLoop.scala:210)
    at dotty.tools.dotc.repl.REPL.doCompile(REPL.scala:43)
    at dotty.tools.dotc.Driver.process(Driver.scala:124)
    at dotty.tools.dotc.Driver.process(Driver.scala:93)
    at dotty.tools.dotc.Driver.process(Driver.scala:105)
    at xsbt.ConsoleInterface.run(ConsoleInterface.scala:46)
    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 sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
    at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:76)
    at sbt.Console.sbt$Console$$console0$1(Console.scala:22)
    at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:23)
    at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
    at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply(Console.scala:23)
    at sbt.Logger$$anon$4.apply(Logger.scala:84)
    at sbt.TrapExit$App.run(TrapExit.scala:248)
    at java.lang.Thread.run(Thread.java:745)
java.lang.RuntimeException: Nonzero exit code: 1
    at scala.sys.package$.error(package.scala:27)
    at sbt.Defaults$$anonfun$consoleTask$1$$anonfun$apply$42.apply(Defaults.scala:824)
    at sbt.Defaults$$anonfun$consoleTask$1$$anonfun$apply$42.apply(Defaults.scala:824)
    at scala.Option.foreach(Option.scala:236)
    at sbt.Defaults$$anonfun$consoleTask$1.apply(Defaults.scala:824)
    at sbt.Defaults$$anonfun$consoleTask$1.apply(Defaults.scala:819)
    at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:35)
    at scala.Function8$$anonfun$tupled$1.apply(Function8.scala:34)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
@odersky
Copy link
Contributor

odersky commented Jul 25, 2016

I think we should just wait with fixing this until we can drop the limit altogether.

@nicolasstucki
Copy link
Contributor Author

Fixed by #1758.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants