Skip to content

Crash: val _ = <MethodHandle> causes cyclic reference #26646

Description

@fwbrasil

Compiler version

3.9.0-RC4. Reproduces on JDK 21 and 25.

Minimized code

//> using scala 3.9.0-RC4

import java.lang.invoke.MethodHandle

object M:
    def h: MethodHandle = ???
    val _ = h

Output (click arrow to expand)

Details
exception caught when loading class ClassSpecializer: Cyclic reference involving class ClassSpecializer
exception caught when loading class SpeciesData: Cyclic reference involving class ClassSpecializer

  unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on Repro.scala

  An unhandled exception was thrown in the compiler.

     while compiling: Repro.scala
        during phase: MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, checkStatic, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher}
                mode: Mode(ImplicitsEnabled)
     library version: version 3.9.0-RC4
    compiler version: version 3.9.0-RC4

Exception in thread "main" dotty.tools.dotc.core.CyclicReference: Cyclic reference involving class ClassSpecializer
Compilation failed

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions