Skip to content

Invoke compiled enum class file from dotr failed #7424

Closed
@Eastsun

Description

@Eastsun

minimized code

enum A {
  case A1
}

~/enum-bug > ls
A.scala
 ~/enum-bug > cat A.scala
enum A {
  case A1
}%                                                                                                                               

~/enum-bug > dotc A.scala
~/enum-bug > dotc -version
Dotty compiler version 0.19.0-RC1 -- Copyright 2002-2019, LAMP/EPFL
~/enum-bug > dotr
Starting dotty REPL...
scala> A.values
java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    rs$line$1$.<init>()V @12: invokevirtual
  Reason:
    Type 'A$' (current frame, stack[1]) is not assignable to 'A'
  Current Frame:
    bci: @12
    flags: { }
    locals: { 'rs$line$1$' }
    stack: { 'rs$line$1$', 'A$' }
  Bytecode:
    0x0000000: 2ab7 0011 2ab3 0013 2ab2 0018 b600 1eb5
    0x0000010: 0020 b1

        at rs$line$1.res0(rs$line$1)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at dotty.tools.repl.Rendering.$anonfun$3(Rendering.scala:72)
        at scala.Option.map(Option.scala:242)
        at dotty.tools.repl.Rendering.valueOf(Rendering.scala:72)
        at dotty.tools.repl.Rendering.renderVal(Rendering.scala:95)
        at dotty.tools.repl.ReplDriver.displayMembers$3$$anonfun$3(ReplDriver.scala:285)
        at scala.collection.immutable.List.map(List.scala:219)
        at scala.collection.immutable.List.map(List.scala:79)
        at dotty.tools.repl.ReplDriver.displayMembers$6(ReplDriver.scala:285)
        at dotty.tools.repl.ReplDriver.displayDefinitions$$anonfun$3$$anonfun$2(ReplDriver.scala:311)
        at scala.Option.map(Option.scala:242)
        at dotty.tools.repl.ReplDriver.displayDefinitions$$anonfun$1(ReplDriver.scala:311)
        at dotty.tools.dotc.core.Phases.atPhase$$anonfun$1(Phases.scala:35)
        at dotty.tools.dotc.core.Periods.atPhase(Periods.scala:25)
        at dotty.tools.dotc.core.Phases.atPhase(Phases.scala:35)
        at dotty.tools.dotc.core.Contexts$Context.atPhase(Contexts.scala:71)
        at dotty.tools.repl.ReplDriver.displayDefinitions(ReplDriver.scala:317)
        at dotty.tools.repl.ReplDriver.compile$$anonfun$2(ReplDriver.scala:241)
        at scala.util.Either.fold(Either.scala:189)
        at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:241)
        at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:193)
        at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:127)
        at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:130)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:148)
        at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:130)
        at dotty.tools.repl.Main$.main(Main.scala:6)
        at dotty.tools.repl.Main.main(Main.scala)

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