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
Compiler Hangs and Runs Out of Memory for very small file #5580
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5580?orig=1
|
@retronym said (edited on Mar 17, 2012 11:57:10 AM UTC): Your code contains a type error -- this change will make it correct: When the compiler encounters this error, it triggers an implicit search to convert So, the compiler tries to use: collection.JavaConversions.asJavaDictionary(map).put(tmp, collection.mutable.Set()) This line of code, when compiled verbatim fails as one expects. The compiler infers the type argument as: scala.collection.JavaConversions.asJavaDictionary[AnyRef, scala.collection.mutable.Map[Bar,scala.collection.mutable.Set[Bar]]] and fails with: error: polymorphic expression cannot be instantiated to expected type;
found : [A]scala.collection.mutable.Set[A]
required: scala.collection.mutable.Map[Bar,scala.collection.mutable.Set[Bar]]
collection.JavaConversions.asJavaDictionary(map).put(tmp, collection.mutable.Set())
But for implicit views, things proceed along a different path. The inferred type arguments are: collection.this.JavaConversions.asJavaDictionary[AnyRef, <284574 characters of inferred type elided>] No, really. I've attached said [^gargantuan-type.txt] for posterity. Unsurprisingly, the second argument to
It seems that this work is all for nought anyway -- we just want to rule out ineligible implicit views, the carefully crafted message wouldn't make it to the user anyway. |
@paulp said: Impressively, the code actually compiles as-is if I stop TypeDiagnostics from meddling. It's hard for "cavalcade" to be an understatement, but in this case... |
@paulp said: // Note to implementors: the cavalcade of deprecated methods herein should
// serve as a warning to any who follow: don't overload implicit methods. |
@retronym said: I'm surprised it compiles once you removed the hurdle -- which implicit saves the day? |
@paulp said: |
@paulp said: |
@paulp said: |
@paulp said: /** It's a pos test because it does indeed compile,
* not so much because I'm glad it does. Testing
* that error messages created and discarded during
* implicit search don't blow it up.
*/ Fixed as side effect of beautiful rewrite of isSameType.
|
When I try to compile the following program, the compiler runs out of memory after 2 minutes on my machine. Reproduced with all of the above versions. (2.9.0, 2.9.1, 2.10.0-M2). I attached a small test project, including a Gradle build script.
The text was updated successfully, but these errors were encountered: