Skip to content

3.9.0 regression: new Cyclic reference error in the code that worked before #26959

Description

@MateuszKubuszok

Compiler version

3.9.0

Minimized code

lib.scala:

package repro

trait Outer {
  trait InnerSupport { this: Companion.type =>
    def foo: Unit = ()
  }
  val Companion: CompanionTrait
  trait CompanionTrait extends InnerSupport { this: Companion.type => }
}

user.test.scala:

package repro
class User(c: Outer)
scala-cli compile --test --scala 3.9.0 .   # Cyclic reference involving trait CompanionTrait
scala-cli compile --test --scala 3.8.4 .   # Compiles fine

Output

Compiling project (test, Scala 3.9.0, JVM (22))
Error compiling project (test, Scala 3.9.0, JVM (22))
Error: Unexpected error when compiling repro-final_088de9e3c3-test: dotty.tools.dotc.core.CyclicReference: Cyclic reference involving trait CompanionTrait

 Run with -explain-cyclic for more details.

Compilation failed

Expectation

Compiling project (Scala 3.9.0, JVM (22))
Compiled project (Scala 3.9.0, JVM (22))
Compiling project (test, Scala 3.9.0, JVM (22))
Compiled project (test, Scala 3.9.0, JVM (22))

Context: I bumped Scala 3 version to 3.9.0 on Kindlings in this PR. The code worked before, as far as I can tell it is correct - if I compile the macro, I can run it against 3.9.0 (e.g. I bumped Chimney to use that newer version of Hearth yesterday, and moved Chimney to 3.9.0 and it works). Kindlings however fails, and apparently it fails in its macro-extensions definition. This is minimization of
the pattern that occurs there which should work since 3.3.8 till 3.8.4 and fail on 3.9.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lambda-liftitype:bugregressionThis worked in a previous version but doesn't anymorestat:fixed in nextThe issue was fixed in Next and only still applies to LTS.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions