Skip to content

Crash when refining a private type member #19929

Closed
@EugeneFlesselle

Description

@EugeneFlesselle

Compiler version

3.4.2-RC1

Minimized code

trait A:
  private type M

def foo(a: A{type M = Int}) =
  val _: a.M = ??? // crash

Note that replacing ??? with 0 gives an error instead.

Output (click arrow to expand)

  exception while retyping val _$1: a.M = ??? of class ValDef # -1

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Yno-enrich-error-messages.

     while compiling: tests/playground/example.scala
        during phase: MegaPhase{elimErasedValueType, pureStats, vcElideAllocations, etaReduce, arrayApply, elimPolyFunction, tailrec, completeJavaEnums, mixin, lazyVals, memoize, nonLocalReturns, capturedVars}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.2-RC1-bin-SNAPSHOT-nonbootstrapped-git-3694d95
            settings: -classpath /Users/eugeneflesselle/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.12/scala-library-2.13.12.jar:/Users/eugeneflesselle/Documents/dotty/library/../out/bootstrap/scala3-library-bootstrapped/scala-3.4.2-RC1-bin-SNAPSHOT-nonbootstrapped/scala3-library_3-3.4.2-RC1-bin-SNAPSHOT.jar -d /
cannot resolve reference to type (a : A{type M = Int}).M
the classfile defining the type might be missing from the classpath

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions