Stack overflow in ImportSuggestions#distinctRefs
See original GitHub issueScala version: 3.0.0 CATS library: 2.6.1 JDK: Azul Zulu 11.0.11 SBT: 1.5.4
Compile under Maven, it throws the following exception. The error message does not pinpoint a specific source file that caused the issue so I can’t be more specific than this.
[ERROR] ## Exception when compiling 54 sources to /home/chris/IdeaProjects/CatsTest3/target/classes
java.lang.StackOverflowError
scala.collection.StrictOptimizedLinearSeqOps.loop$3(LinearSeq.scala:266)
scala.collection.StrictOptimizedLinearSeqOps.dropWhile(LinearSeq.scala:268)
scala.collection.StrictOptimizedLinearSeqOps.dropWhile$(LinearSeq.scala:264)
scala.collection.immutable.List.dropWhile(List.scala:79)
dotty.tools.dotc.typer.ImportSuggestions.distinctRefs(ImportSuggestions.scala:275)
dotty.tools.dotc.typer.ImportSuggestions.distinctRefs$(ImportSuggestions.scala:23)
dotty.tools.dotc.typer.Typer.distinctRefs(Typer.scala:103)
dotty.tools.dotc.typer.ImportSuggestions.distinctRefs(ImportSuggestions.scala:275)
dotty.tools.dotc.typer.ImportSuggestions.distinctRefs$(ImportSuggestions.scala:23)
dotty.tools.dotc.typer.Typer.distinctRefs(Typer.scala:103)
... last stack frame above repeated many times ...
...
When compile under sbt, it reports a number of errors. The last of which is the following. Then the console hangs at compile incremental with the timer keeps ticking:
[error] 457 | } yield passwordOk
[error] | ^
[error] |Could not find an instance of FlatMap for cats.Id.
[error] |I found:
[error] |
[error] | cats.Invariant.catsStdCommutativeMonadForTuple11[A0, A1, A2, A3, A4, A5, A6, A7
[error] | ,
[error] | A8, A9]
[error] |
[error] |But method catsStdCommutativeMonadForTuple11 in trait NTupleMonadInstances1 does not match type cats.FlatMap[cats.Id].
[error] -- [E008] Not Found Error: xxx.scala:48:25
[error] 48 | import scala.reflect.runtime.universe
[error] | ^^^^^^^^^^^^^^^^^^^^^
[error] | value runtime is not a member of reflect
| => root / Compile / compileIncremental 457s
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
How to import and use different packages of the same name
The code above gives two different names to the imported packages with the same name. So, there are now two different identifiers that...
Read more >Why hooks are the best thing to happen to React
This article will explain what hooks are, what makes them unique, and why they are the best thing to happen to React.
Read more >48 answers on StackOverflow to the most popular Angular ...
I gathered the most common questions and answers from Stackoverflow. These questions were chosen by the highest score received.
Read more >Cross-referencing between different files - TeX
tex I have \label{a} and I want to access this in file chapterII.tex using something like \ref{a} . How to do this exactly...
Read more >Import arbitrary code from Stack Overflow as Python modules.
Do you ever feel like all you're doing is copy/pasting from Stack Overflow? Let's take it one step further. ... code, it checks...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Regardless of whether we can reproduce, I think it wouldn’t be a bad idea to rewrite
distinctRefs
to be stack-safe (e.g., as a while loop accumulating into a ListBuffer).Possible regression with version 3.0.2. The stack overflow issue comes back when compiling with 3.0.2. The issue went away when compiled with 3.0.1.