diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-17 18:04:23 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-07-17 19:17:15 +0200 |
commit | 06b373878a044e0a83e5162bca661a6050957d04 (patch) | |
tree | d4acc6da509d271a3bb481694fca2d1f5f64fce0 /src/reflect/scala/reflect/internal/Constants.scala | |
parent | 0cfd858a38ddf0ac83d9bbefe85110f88dc707c0 (diff) | |
download | scala-06b373878a044e0a83e5162bca661a6050957d04.tar.gz scala-06b373878a044e0a83e5162bca661a6050957d04.tar.bz2 scala-06b373878a044e0a83e5162bca661a6050957d04.zip |
SI-5731 a few fixes for value classes
I've faced two gotchas.
First of all posterasure, which is supposed to erase ErasedValueType types,
didn't look into ConstantType.value that is known to be smuggling types
(hi Paul that's a plus one).
Secondly ClassManifest.classType[T] assumed that its T is bound by AnyRef,
which is not the case for value types. Here I had two choices:
a) introduce a special method for manifests of value types,
b) remove the upper bound of the type parameter and call it a day.
Since manifests are already deprecated and there's no difference which
method was used to create which manifest, I went for option b).
Diffstat (limited to 'src/reflect/scala/reflect/internal/Constants.scala')
-rw-r--r-- | src/reflect/scala/reflect/internal/Constants.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/Constants.scala b/src/reflect/scala/reflect/internal/Constants.scala index 820dfe0868..d6a168ee11 100644 --- a/src/reflect/scala/reflect/internal/Constants.scala +++ b/src/reflect/scala/reflect/internal/Constants.scala @@ -221,7 +221,12 @@ trait Constants extends api.Constants { tag match { case NullTag => "null" case StringTag => "\"" + escape(stringValue) + "\"" - case ClazzTag => "classOf[" + signature(typeValue) + "]" + case ClazzTag => + def show(tpe: Type) = "classOf[" + signature(tpe) + "]" + typeValue match { + case ErasedValueType(orig) => show(orig) + case _ => show(typeValue) + } case CharTag => "'" + escapedChar(charValue) + "'" case LongTag => longValue.toString() + "L" case EnumTag => symbolValue.name.toString() |