diff options
author | Paul Phillips <paulp@improving.org> | 2011-07-12 19:43:14 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-07-12 19:43:14 +0000 |
commit | 70da5a627fe2ce15df64741b5784ed97c361a95e (patch) | |
tree | b689950c0eba88d27e06c2baf4a56d4a2e8c5461 /src/compiler/scala/tools/nsc/interpreter/ILoop.scala | |
parent | 6163cdcc236698b333016becc57f545098760e32 (diff) | |
download | scala-70da5a627fe2ce15df64741b5784ed97c361a95e.tar.gz scala-70da5a627fe2ce15df64741b5784ed97c361a95e.tar.bz2 scala-70da5a627fe2ce15df64741b5784ed97c361a95e.zip |
A bunch of repl stuff.
type mismatches, for real this time. :power mode goes to phase typer
automatically.
You can get the symbols for repl-defined names more directly:
scala> case class Bippy(x: Int)
defined class Bippy
scala> intp.terms("Bippy")
res1: intp.global.Symbol = object Bippy
scala> intp.types("Bippy")
res2: intp.global.Symbol = class Bippy
scala> intp("Bippy") // tries type first
res3: intp.global.Symbol = class Bippy
scala> intp("scala.collection.Map") // falls back to fully qualified
res4: intp.global.Symbol = trait Map
I changed the implicit which used to install "tpe" and "symbol" to
install "tpe_" and "symbol_" because it was too easy to do something you
didn't mean to, like calling x.tpe where x is a Manifest.
Said implicit now handles manifest type arguments, so you can get the
full translation from a manifest representation to a compiler type, at
least for simple types and only as much as manifests work, which is not
that much. Fortunately that situation is all changing soon.
scala> List(List(1, 2, 3)).tpe_
res5: power.Type = List[List[Int]]
scala> res5.typeArgs
res6: List[power.global.Type] = List(List[Int])
Review by moors.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/ILoop.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/ILoop.scala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala index b249d37006..8e7f73296f 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala @@ -43,11 +43,11 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) var settings: Settings = _ var intp: IMain = _ + override def echoCommandMessage(msg: String): Unit = + intp.reporter.printMessage(msg) + def isAsync = !settings.Yreplsync.value - lazy val power = { - val g = intp.global - Power[g.type](this, g) - } + lazy val power = Power(this) // TODO // object opt extends AestheticSettings @@ -622,6 +622,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter) def enablePowerMode(isDuringInit: Boolean) = { replProps.power setValue true power.unleash() + intp.beSilentDuring(phaseCommand("typer")) if (isDuringInit) asyncMessage(power.banner) else echo(power.banner) } |