Skip to content

Stack overflow in ImportSuggestions#distinctRefs #12876

Closed
@chrislailee

Description

@chrislailee

Scala 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:reportingError reporting including formatting, implicit suggestions, etcitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions