scala-ide / scala-worksheet

A Scala IDE plugin for a multi-line REPL (called worksheet)
96 stars 24 forks source link

import inside object on top fails #80

Closed lrytz closed 11 years ago

lrytz commented 12 years ago

this fails

object Flumi {
  import scala.math.abs
  abs(1)
}

it generates this

object Flumi {
  import scala.math.absimport scala.runtime.WorksheetSupport._; def main(args: Array[String])=$execute{;$skip(47); val res$0 = 
  abs(1);System.out.println("""res0: Int = """ + $show(res$0))}
}

if you add a statement before the import, we're good

object Flumi {
  val x = 0                                       //> x  : Int = 0
  import scala.math.abs
  abs(1)                                          //> res0: Int = 1
}
dragos commented 12 years ago

@odersky, can you please have a look? This is an issue in the instrumenter, so it needs to be fixed on the compiler side. Better do it before RC1!

dotta commented 11 years ago

This appears to be fixed in V0.1.2