From 70da5a627fe2ce15df64741b5784ed97c361a95e Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 12 Jul 2011 19:43:14 +0000 Subject: 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. --- test/files/run/repl-power.check | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/files') diff --git a/test/files/run/repl-power.check b/test/files/run/repl-power.check index 9561c04eca..1b3883a839 100644 --- a/test/files/run/repl-power.check +++ b/test/files/run/repl-power.check @@ -2,12 +2,11 @@ Type in expressions to have them evaluated. Type :help for more information. scala> :power -** Power User mode enabled - BEEP BOOP WHIR ** +** Power User mode enabled - BEEP BOOP SPIZ ** +** :phase has been set to 'typer'. ** ** scala.tools.nsc._ has been imported ** ** global._ and definitions._ also imported ** -** New vals! Try repl, intp, global, power ** -** New cmds! :help to discover them ** -** New defs! Type power. to reveal ** +** Try :help, vals., power. ** scala> // guarding against "error: reference to global is ambiguous" -- cgit v1.2.3