Skip to content

Two examplars of type-dependent type bring REPL to runtime error #2310

Closed
@scalasolist

Description

@scalasolist

paste into REPL:

trait Parent {
  sealed trait HNil
  object HNil extends HNil
}

trait Single extends Parent {
  val u = HNil
}

Try the following code:

scala> object X extends Single
defined module X
scala> object Y extends Single
defined module Y
scala> X.u
val res0: X.HNil.type = Parent$HNil$@2b14d160
scala> Y.u

get the error:

java.lang.IncompatibleClassChangeError: Interface method reference: Parent.HNil()LParent$HNil$;, is in an indirect superinterface of Y$
    at Y$.HNil(<console>:4)
    at Single.initial$u(AbsHList.scala:46)
    at Y$.<init>(<console>:4)
    at Y$.<clinit>(<console>)
    at .<init>(<console>:6)
    at .<clinit>(<console>)
    at RequestResult$.<init>(<console>:3)
    at Reques...

I could not reproduce that error outside REPL in a standalone application

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions