scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Compiler enters infinite loop with extension method on akka streams

Open Krever opened this issue 6 months ago • 0 comments

Sorry for the poor issue title, I didn't have time to minimize it further and remove the akka dependency.

Compiler version

3.7.0

Minimized example

//> using scala "3.7.0"
//> using dep "com.typesafe.akka::akka-stream:2.8.8"

import akka.actor.ActorSystem
import akka.stream.scaladsl._
import akka.stream.KillSwitches
import akka.NotUsed

import scala.concurrent.Future

implicit class XXXX[+Out, +Mat, ReprMat[+O, +M] <: FlowOpsMat[O, M]](val stream: ReprMat[Out, Mat]) {
  def traceStream1(): stream.ReprMat[Out, Mat] = ???
}

def a: Source[Int, NotUsed]                 = ???
def b: Sink[Int, Future[Option[Int]]] = ???
a.traceStream1()
  .viaMat(KillSwitches.single)(Keep.right)
  .alsoToMat(b)(Keep.both)
  .map(_._2)

Output

None, compiler never finishes running

Expectation

It compiles or throws an error.

Krever avatar May 27 '25 09:05 Krever