diff options
author | Paul Phillips <paulp@improving.org> | 2013-05-23 10:00:50 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-05-23 12:07:45 -0700 |
commit | d8b96bb8583161e59180527bab0283f783466426 (patch) | |
tree | a12ecf17379a579d5a2f4bda7a16819001eadb77 /test | |
parent | b8641a97d669c945a1b9f47b4e8934aa6c98ffd7 (diff) | |
download | scala-d8b96bb8583161e59180527bab0283f783466426.tar.gz scala-d8b96bb8583161e59180527bab0283f783466426.tar.bz2 scala-d8b96bb8583161e59180527bab0283f783466426.zip |
Concision contribution.
We have lots of core classes for which we need not go through
the symbol to get the type:
ObjectClass.tpe -> ObjectTpe
AnyClass.tpe -> AnyTpe
I updated everything to use the concise/direct version,
and eliminated a bunch of noise where places were calling
typeConstructor, erasedTypeRef, and other different-seeming methods
only to always wind up with the same type they would have received
from sym.tpe. There's only one Object type, before or after erasure,
with or without type arguments.
Calls to typeConstructor were especially damaging because (see
previous commit) it had a tendency to cache a different type than
the type one would find via other means. The two types would
compare =:=, but possibly not == and definitely not eq. (I still
don't understand what == is expected to do with types.)
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/tpeCache-tyconCache.check | 19 | ||||
-rw-r--r-- | test/files/run/tpeCache-tyconCache.scala | 10 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/files/run/tpeCache-tyconCache.check b/test/files/run/tpeCache-tyconCache.check new file mode 100644 index 0000000000..a892f5477a --- /dev/null +++ b/test/files/run/tpeCache-tyconCache.check @@ -0,0 +1,19 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> :power +** Power User mode enabled - BEEP WHIR GYVE ** +** :phase has been set to 'typer'. ** +** scala.tools.nsc._ has been imported ** +** global._, definitions._ also imported ** +** Try :help, :vals, power.<tab> ** + +scala> + +scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor +res0: Boolean = true + +scala> AnyRefClass.tpe eq AnyRefClass.typeConstructor +res1: Boolean = true + +scala> diff --git a/test/files/run/tpeCache-tyconCache.scala b/test/files/run/tpeCache-tyconCache.scala new file mode 100644 index 0000000000..f907167a33 --- /dev/null +++ b/test/files/run/tpeCache-tyconCache.scala @@ -0,0 +1,10 @@ +import scala.tools.partest.ReplTest + +object Test extends ReplTest { + override def code = """ +:power + +AnyRefClass.tpe eq AnyRefClass.typeConstructor +AnyRefClass.tpe eq AnyRefClass.typeConstructor + """.trim +} |