bug icon indicating copy to clipboard operation
bug copied to clipboard

Toolbox can't compile package declaration

Open alex-ivanov opened this issue 7 years ago • 3 comments

Toolbox can't compile code if it has package declaration. Next code produces an AssertionError error:

    import scala.tools.reflect.ToolBox
    import scala.reflect.runtime.currentMirror
    val tb = ToolBox(currentMirror).mkToolBox()
    val parsed = tb.parse("package A { case class Test()}")
    tb.compile(parsed)

Exception in thread "main" java.lang.AssertionError: assertion failed: 
  method wrapper
     while compiling: <no file>
        during phase: typer
     library version: version 2.12.7
    compiler version: version 2.12.7
  reconstructed args: 

  last tree to typer: Block
       tree position: <unknown>
              symbol: null
           call site: method wrapper in object __wrapper$1$b4949b3f7ed847808ed0a1e82d913044 in package __wrapper$1$b4949b3f7ed847808ed0a1e82d913044

alex-ivanov avatar Oct 09 '18 21:10 alex-ivanov

I have the same issue. Currently I do not know how to dynamically compile a class into a package.

MarkusLupusWolf avatar Mar 25 '19 11:03 MarkusLupusWolf

Is it going to be solved ? or it is abandoned ?

pranjut avatar Feb 06 '22 22:02 pranjut

Nobody's working on it. I don't think anybody has even looked into what a fix would involve.

SethTisue avatar Feb 07 '22 00:02 SethTisue