Skip to content

Free term is not a legal prefix for constructor #7083

@scabug

Description

@scabug
import scala.reflect.runtime.universe._
import scala.tools.reflect.ToolBox
import scala.tools.reflect.Eval

class O { class I }

class A extends O {
  val code = reify {
    val v: I = new I
    v
  }
  println(showRaw(code))
}

object Test extends App {
  val v: A#I = (new A).code.eval
}

Class A is reified as free term A$value, and reflective compilation fails on typecheck of the expression new A$value.I() with the following error:

issue error: Test.this.A is not a legal prefix for a constructor

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions