Skip to content

Regression in scalablytyped/converter with unexpected CyclicError #25700

@WojciechMazur

Description

@WojciechMazur

Based on the OpenCB failure in scalablytyped/converter - build logs

Compiler version

Fails in 3.8.4-RC1
Last good release: 3.8.4-RC1-bin-20260320-715b38a-NIGHTLY
First bad release: 3.8.4-RC1-bin-20260321-c486a97-NIGHTLY

Bisect points to e81f069 / #25566

Minimized code

sealed trait Updater
final class Initializer extends Updater
final class Mutator extends Updater

final class IArray[+A]
val Empty = new IArray[Nothing]

def partitionCollect2[A, A1, A2](
    as: IArray[A],
    t1: PartialFunction[A, A1],
    t2: PartialFunction[A, A2],
): (IArray[A1], IArray[A2], IArray[A]) =
  ???

def test(updaters: IArray[Updater]) =
  val (mutators: IArray[Mutator], initializers: IArray[Initializer], Empty) =
    partitionCollect2(
      updaters,
      { case x: Mutator     => x },
      { case x: Initializer => x },
    )

Output

> scala compile repo/test.scala -S 3.8.4-RC1 -explain-cyclic
Compiling project (Scala 3.8.4-RC1, JVM (21))
[error] ./repo/test.scala:16:70
[error] Recursive value $2$ needs type
[error] 
[error] The error occurred while trying to compute the signature of method test
[error]   which required to type the right hand side of method test since no explicit type was given
[error]   which required to compute the signature of value $2$
[error]   which required to type the right hand side of value $2$ since no explicit type was given
[error]   which required to compute the signature of value Empty
[error]   which required to type the right hand side of value Empty since no explicit type was given
[error]   which required to compute the signature of value $2$
[error] 
[error]  Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
[error]   val (mutators: IArray[Mutator], initializers: IArray[Initializer], Empty) =
[error]                                                                      ^
Error compiling project (Scala 3.8.4-RC1, JVM (21))
Compilation failed

Expectation

Source code does not suggest a cyclic dependency might be possible. It should compile like it did in 3.8.3

Metadata

Metadata

Assignees

Labels

area:desugarDesugaring happens after parsing but before typing, see desugar.scalaitype:bugregressionThis worked in a previous version but doesn't anymore

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions