Open mschlaipfer opened 6 years ago
I wrote a code generator for F# and fsharpc
on the "equivalent" F# program terminates within less than a second (with a type error as of now), so I think this is a valid Scala issue.
I wonder if Scala 3 does any better here.
Dotty errors immediately by cheating.
➜ ~/projects/dotty/bin/scalac -d /tmp t10964.scala
-- Error: t10964.scala:48:18 -------------------------------------------------------------------------------------------
48 | v_86: ( Int => Unit ) =>
| ^^^^^^^^^^^
| not a legal formal parameter for a function literal
***
parentheses are required around the parameter of a lambda
I am trying to synthesize Scala code automatically and unfortunately the Scala type checker runs out of memory when running
sbt compile
on this generated code. I currently start sbt withsbt -J-Xmx6G -J-Xms6G -J-Xss40M -J-XX:+UseConcMarkSweepGC
The code causing it is at the bottom. It contains a deeply nested lambda term. The program might contain errors in and of itself.
I guess my question would be, what are the issues that I'm causing in the type checker (or should the type checker actually be able to handle such a term with "reasonable" amount of memory usage) and what would be a good workaround. I can think of, for example, breaking up the term into smaller sub-terms. Also, I'm not yet providing all the type annotations possible.
The code that causes the type checker to run OOM: