Avinash Varma
Avinash Varma

Reputation: 43

Scala Presentation Compiler

Hi I've been trying to get the presentation compiler to work but I'm getting the following error. Any help regarding this would be appreciated. I've already seen other questions and few projects where it has been implemented but everyone uses the Global.Run which is not being recognized in the REPL. This the code and the error below it. I've installed scala 2.10.3 in windows 8.1

import scala.tools.nsc.{Global,Settings}
import scala.tools.nsc.reporters._

object Test {
  def main (args: Array[String]) {
    val settings = new Settings;
    val global = new Global(settings,new ConsoleReporter(settings));
    val compiler = global.Run;
  }
}

The error is Sample.scala:8: error: value Run is not a member of scala.tools.nsc.Global

Upvotes: 1

Views: 212

Answers (1)

yǝsʞǝla
yǝsʞǝla

Reputation: 16412

Try this:

import scala.tools.nsc.{Global,Settings}
import scala.tools.nsc.reporters._

object Test {
  def main (args: Array[String]) {
    val settings = new Settings
    val global = new Global(settings,new ConsoleReporter(settings))
    val compiler = new global.Run
  }
}

Notice new Run instead of Run. There is no companion object for class Run. Maybe it was there before in earlier scala versions. Checked on Scala v2.10.3. Works in REPL.

Upvotes: 3

Related Questions