summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-07-12 19:43:14 +0000
committerPaul Phillips <paulp@improving.org>2011-07-12 19:43:14 +0000
commit70da5a627fe2ce15df64741b5784ed97c361a95e (patch)
treeb689950c0eba88d27e06c2baf4a56d4a2e8c5461 /src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala
parent6163cdcc236698b333016becc57f545098760e32 (diff)
downloadscala-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/LoopCommands.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala b/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala
index 188f891054..9469baa4e2 100644
--- a/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/LoopCommands.scala
@@ -29,6 +29,9 @@ object ProcessResult {
trait LoopCommands {
protected def out: JPrintWriter
+ // So outputs can be suppressed.
+ def echoCommandMessage(msg: String): Unit = out println msg
+
// a single interpreter command
abstract class LoopCommand(val name: String, val help: String) extends (String => Result) {
private var _longHelp: String = null
@@ -95,7 +98,7 @@ trait LoopCommands {
// to print something to the console, so we accomodate Unit and String returns.
implicit def resultFromUnit(x: Unit): Result = default
implicit def resultFromString(msg: String): Result = {
- out println msg
+ echoCommandMessage(msg)
default
}
}