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 /test/files | |
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 'test/files')
-rw-r--r-- | test/files/run/repl-power.check | 7 |
1 files changed, 3 insertions, 4 deletions
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.<tab> to reveal ** +** Try :help, vals.<tab>, power.<tab> ** scala> // guarding against "error: reference to global is ambiguous" |