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

Compiler should not catch StackOverflowError #10649

Closed
olafurpg opened this issue Dec 7, 2017 · 2 comments
Closed

Compiler should not catch StackOverflowError #10649

olafurpg opened this issue Dec 7, 2017 · 2 comments

Comments

@olafurpg
Copy link
Member

olafurpg commented Dec 7, 2017

While upgrading scalafix to 2.12.4 I observed a regression while inferring an implicit typeclass instance. The implicit resolved fine in 2.12.3, but not in 2.12.4. After spending a good part of my day trying to track down what caused the regression I noticed that a StackOverflowError is getting caught and reported under -Xlog-implicits

[info]  [E420] scalafix-cli/src/main/scala/scalafix/internal/cli/ArgParserImplicits.scala
[info]         shapeless.this.Strict.mkStrict is not a valid implicit value for shapeless.Strict[caseapp.core.HListParser.Aux[Int with shapeless.labelled.KeyTag[Symbol with shapeless.tag.Tagged[String("stackVerbosity")],Int] :: shapeless.HNil,Option[Int] :: shapeless.HNil,scala.collection.immutable.Nil.type :: shapeless.HNil,None.type :: shapeless.HNil,None.type :: shapeless.HNil,Some[caseapp.Hidden] :: shapeless.HNil,None.type :: shapeless.HNil,PT]] because:
[info]         hasMatchingSymbol reported error: exception during macro expansion:
[info]         java.lang.StackOverflowError
[info]         	at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedConstructorPattern(PatternTypers.scala:61)
[info]         	at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedConstructorPattern$(PatternTypers.scala:70)

Full output from -Xlog-implicits https://gist.github.com/olafurpg/715838db3776282939b5a30042cc2605#file-2-12-4-stackoverflow-txt-L859

I don't think the compiler should be catching fatal errors like this and optionally reporting them under a flag. A StackOverflowError should propagate immediately to the user, and that would have saved me a lot of time today.

Related issue: #10604 (comment)
PR upgrading scalafix to 2.12.4 scalacenter/scalafix#477 (comment)

@joroKr21
Copy link
Member

joroKr21 commented Dec 7, 2017

The related issue in shapeless is milessabin/shapeless#776 and the underlying cause in scalac is #10552

@olafurpg
Copy link
Member Author

olafurpg commented Dec 7, 2017

Thanks @joroKr21 I will close this as a duplicate then.

@olafurpg olafurpg closed this as completed Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants