diff options
author | Paul Phillips <paulp@improving.org> | 2011-05-03 00:43:12 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-05-03 00:43:12 +0000 |
commit | 0bfaa0baf4aa7eed7f14839caf73d167ea074a75 (patch) | |
tree | 9a42f83d51e8d0799cff37e814dc32dc098c7130 /src/compiler/scala/tools/nsc/interpreter/IMain.scala | |
parent | cb74fc1c8a4919edacf1274aee7c9229d064a35e (diff) | |
download | scala-0bfaa0baf4aa7eed7f14839caf73d167ea074a75.tar.gz scala-0bfaa0baf4aa7eed7f14839caf73d167ea074a75.tar.bz2 scala-0bfaa0baf4aa7eed7f14839caf73d167ea074a75.zip |
Looks like the :type command was a casualty of ...
Looks like the :type command was a casualty of a repl fix. Make :type
command work, no review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/IMain.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/IMain.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index 2eeefbefce..a364f218da 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -481,9 +481,9 @@ class IMain(val settings: Settings, protected val out: PrintWriter) extends Impo if (succeeded) { if (printResults) show() - if (!synthetic) // book-keeping - recordRequest(req) - + // Book-keeping. Have to record synthetic requests too, + // as they may have been issued for information, e.g. :type + recordRequest(req) IR.Success } else { @@ -924,6 +924,7 @@ class IMain(val settings: Settings, protected val out: PrintWriter) extends Impo // 3) Try interpreting it as an expression. private var typeOfExpressionDepth = 0 def typeOfExpression(expr: String): Option[Type] = { + DBG("typeOfExpression(" + expr + ")") if (typeOfExpressionDepth > 2) { DBG("Terminating typeOfExpression recursion for expression: " + expr) return None @@ -938,7 +939,9 @@ class IMain(val settings: Settings, protected val out: PrintWriter) extends Impo def asModule = safeModule(expr) map (_.tpe) def asExpr = beSilentDuring { val lhs = freshInternalVarName() - interpret("lazy val " + lhs + " = { " + expr + " } ", true) match { + val line = "lazy val " + lhs + " = { " + expr + " } " + + interpret(line, true) match { case IR.Success => typeOfExpression(lhs) case _ => None } |