@@ -394,9 +394,9 @@ class Definitions {
394394 def ArrayModule (implicit ctx : Context ) = ArrayModuleType .symbol.moduleClass.asClass
395395
396396
397- lazy val UnitType : TypeRef = valueTypeRef(" scala.Unit" , BoxedUnitType , java.lang.Void .TYPE , UnitEnc )
397+ lazy val UnitType : TypeRef = valueTypeRef(" scala.Unit" , BoxedUnitType , java.lang.Void .TYPE , UnitEnc , nme.specializedTypeNames. Void )
398398 def UnitClass (implicit ctx : Context ) = UnitType .symbol.asClass
399- lazy val BooleanType = valueTypeRef(" scala.Boolean" , BoxedBooleanType , java.lang.Boolean .TYPE , BooleanEnc )
399+ lazy val BooleanType = valueTypeRef(" scala.Boolean" , BoxedBooleanType , java.lang.Boolean .TYPE , BooleanEnc , nme.specializedTypeNames. Boolean )
400400 def BooleanClass (implicit ctx : Context ) = BooleanType .symbol.asClass
401401 lazy val Boolean_notR = BooleanClass .requiredMethodRef(nme.UNARY_! )
402402 def Boolean_! = Boolean_notR .symbol
@@ -415,13 +415,13 @@ class Definitions {
415415 })
416416 def Boolean_!= = Boolean_neqeqR .symbol
417417
418- lazy val ByteType : TypeRef = valueTypeRef(" scala.Byte" , BoxedByteType , java.lang.Byte .TYPE , ByteEnc )
418+ lazy val ByteType : TypeRef = valueTypeRef(" scala.Byte" , BoxedByteType , java.lang.Byte .TYPE , ByteEnc , nme.specializedTypeNames. Byte )
419419 def ByteClass (implicit ctx : Context ) = ByteType .symbol.asClass
420- lazy val ShortType : TypeRef = valueTypeRef(" scala.Short" , BoxedShortType , java.lang.Short .TYPE , ShortEnc )
420+ lazy val ShortType : TypeRef = valueTypeRef(" scala.Short" , BoxedShortType , java.lang.Short .TYPE , ShortEnc , nme.specializedTypeNames. Short )
421421 def ShortClass (implicit ctx : Context ) = ShortType .symbol.asClass
422- lazy val CharType : TypeRef = valueTypeRef(" scala.Char" , BoxedCharType , java.lang.Character .TYPE , CharEnc )
422+ lazy val CharType : TypeRef = valueTypeRef(" scala.Char" , BoxedCharType , java.lang.Character .TYPE , CharEnc , nme.specializedTypeNames. Char )
423423 def CharClass (implicit ctx : Context ) = CharType .symbol.asClass
424- lazy val IntType : TypeRef = valueTypeRef(" scala.Int" , BoxedIntType , java.lang.Integer .TYPE , IntEnc )
424+ lazy val IntType : TypeRef = valueTypeRef(" scala.Int" , BoxedIntType , java.lang.Integer .TYPE , IntEnc , nme.specializedTypeNames. Int )
425425 def IntClass (implicit ctx : Context ) = IntType .symbol.asClass
426426 lazy val Int_minusR = IntClass .requiredMethodRef(nme.MINUS , List (IntType ))
427427 def Int_- = Int_minusR .symbol
@@ -437,7 +437,7 @@ class Definitions {
437437 def Int_>= = Int_geR .symbol
438438 lazy val Int_leR = IntClass .requiredMethodRef(nme.LE , List (IntType ))
439439 def Int_<= = Int_leR .symbol
440- lazy val LongType : TypeRef = valueTypeRef(" scala.Long" , BoxedLongType , java.lang.Long .TYPE , LongEnc )
440+ lazy val LongType : TypeRef = valueTypeRef(" scala.Long" , BoxedLongType , java.lang.Long .TYPE , LongEnc , nme.specializedTypeNames. Long )
441441 def LongClass (implicit ctx : Context ) = LongType .symbol.asClass
442442 lazy val Long_XOR_Long = LongType .member(nme.XOR ).requiredSymbol(
443443 x => (x is Method ) && (x.info.firstParamTypes.head isRef defn.LongClass )
@@ -452,9 +452,9 @@ class Definitions {
452452 lazy val Long_divR = LongClass .requiredMethodRef(nme.DIV , List (LongType ))
453453 def Long_/ = Long_divR .symbol
454454
455- lazy val FloatType : TypeRef = valueTypeRef(" scala.Float" , BoxedFloatType , java.lang.Float .TYPE , FloatEnc )
455+ lazy val FloatType : TypeRef = valueTypeRef(" scala.Float" , BoxedFloatType , java.lang.Float .TYPE , FloatEnc , nme.specializedTypeNames. Float )
456456 def FloatClass (implicit ctx : Context ) = FloatType .symbol.asClass
457- lazy val DoubleType : TypeRef = valueTypeRef(" scala.Double" , BoxedDoubleType , java.lang.Double .TYPE , DoubleEnc )
457+ lazy val DoubleType : TypeRef = valueTypeRef(" scala.Double" , BoxedDoubleType , java.lang.Double .TYPE , DoubleEnc , nme.specializedTypeNames. Double )
458458 def DoubleClass (implicit ctx : Context ) = DoubleType .symbol.asClass
459459
460460 lazy val BoxedUnitType : TypeRef = ctx.requiredClassRef(" scala.runtime.BoxedUnit" )
@@ -976,15 +976,17 @@ class Definitions {
976976
977977 private val boxedTypes = mutable.Map [TypeName , TypeRef ]()
978978 private val valueTypeEnc = mutable.Map [TypeName , PrimitiveClassEnc ]()
979+ private val typeTags = mutable.Map [TypeName , Name ]().withDefaultValue(nme.specializedTypeNames.Object )
979980
980981// private val unboxedTypeRef = mutable.Map[TypeName, TypeRef]()
981982// private val javaTypeToValueTypeRef = mutable.Map[Class[_], TypeRef]()
982983// private val valueTypeNameToJavaType = mutable.Map[TypeName, Class[_]]()
983984
984- private def valueTypeRef (name : String , boxed : TypeRef , jtype : Class [_], enc : Int ): TypeRef = {
985+ private def valueTypeRef (name : String , boxed : TypeRef , jtype : Class [_], enc : Int , tag : Name ): TypeRef = {
985986 val vcls = ctx.requiredClassRef(name)
986987 boxedTypes(vcls.name) = boxed
987988 valueTypeEnc(vcls.name) = enc
989+ typeTags(vcls.name) = tag
988990// unboxedTypeRef(boxed.name) = vcls
989991// javaTypeToValueTypeRef(jtype) = vcls
990992// valueTypeNameToJavaType(vcls.name) = jtype
@@ -994,6 +996,9 @@ class Definitions {
994996 /** The type of the boxed class corresponding to primitive value type `tp`. */
995997 def boxedType (tp : Type )(implicit ctx : Context ): TypeRef = boxedTypes(scalaClassName(tp))
996998
999+ /** The JVM tag for `tp` if it's a primitive, `java.lang.Object` otherwise. */
1000+ def typeTag (tp : Type )(implicit ctx : Context ): Name = typeTags(scalaClassName(tp))
1001+
9971002 type PrimitiveClassEnc = Int
9981003
9991004 val ByteEnc = 2
0 commit comments