Closed scabug closed 13 years ago
Imported From: https://issues.scala-lang.org/browse/SI-2355?orig=1 Reporter: Eric Willigers (ewilligers)
@cunei said: Seems to work for me in 2.8.0.r18703. Please reopen if appropriate.
Eric Willigers (ewilligers) said: Perhaps it is Windows specific?
C:...>c:...\2.8.0.r18762-b20090924021911\files\bin\scalac Test.scala Exception in thread "main" java.lang.StackOverflowError at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:3448)
@paulp said: It's not windows specific, it's all-your-local-factors specific, and if you're using java 6 all the memory limitations hit faster. It crashes on snow leopard's jvm6 with default scalac from trunk:
$$ JAVA_OPTS="" scalac28 a.scala
Exception in thread "main" java.lang.StackOverflowError
at scala.tools.nsc.ast.Trees$$Transformer.transform(Trees.scala:1411)
at scala.tools.nsc.typechecker.RefChecks$$RefCheckTransformer.transform(RefChecks.scala:998)
I'm not sure it's a bug though (as opposed to an "implementation limitation") as that's how the typechecker works, you get a pile of stack for each element when it's doing this kind of typing. This is a duplicate of at least one other ticket. Workaround is to use more stack. I'm not closing this as I don't know what the official position is.
@cunei said: This issue is essentially a duplicate of #1667. A simple workaround is splitting the long expression into smaller ones; even for automatically generated source code that can be easily accomplished. Alternatively, just increase your stack size: the example provided compiles if you add "-Xss1M" to JAVA_OPTS.
Either way, this ticket can be seen more like a request for improvement rather than a bug: the concrete usability of the compiler is not impacted significantly by the fact that a single expression with 100 subexpressions requires a slightly larger stack to typecheck.
Closing it as a duplicate of #1667.
Attempting to compile the following code gives a type checker stack overflow crash with 2.7.6.final and 2.8.0.r18678-b20090910020815
The crash also occurs if each "(Mnn: M) ::" is simply "Mnn ::", but the difficulty in type checking is more obvious in that case.
Note the developer can easily avoid the crash by splitting "data" into separate lists.