@@ -394,9 +394,9 @@ class Definitions {
394
394
def ArrayModule (implicit ctx : Context ) = ArrayModuleType .symbol.moduleClass.asClass
395
395
396
396
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 )
398
398
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 )
400
400
def BooleanClass (implicit ctx : Context ) = BooleanType .symbol.asClass
401
401
lazy val Boolean_notR = BooleanClass .requiredMethodRef(nme.UNARY_! )
402
402
def Boolean_! = Boolean_notR .symbol
@@ -415,13 +415,13 @@ class Definitions {
415
415
})
416
416
def Boolean_!= = Boolean_neqeqR .symbol
417
417
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 )
419
419
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 )
421
421
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 )
423
423
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 )
425
425
def IntClass (implicit ctx : Context ) = IntType .symbol.asClass
426
426
lazy val Int_minusR = IntClass .requiredMethodRef(nme.MINUS , List (IntType ))
427
427
def Int_- = Int_minusR .symbol
@@ -437,7 +437,7 @@ class Definitions {
437
437
def Int_>= = Int_geR .symbol
438
438
lazy val Int_leR = IntClass .requiredMethodRef(nme.LE , List (IntType ))
439
439
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 )
441
441
def LongClass (implicit ctx : Context ) = LongType .symbol.asClass
442
442
lazy val Long_XOR_Long = LongType .member(nme.XOR ).requiredSymbol(
443
443
x => (x is Method ) && (x.info.firstParamTypes.head isRef defn.LongClass )
@@ -452,9 +452,9 @@ class Definitions {
452
452
lazy val Long_divR = LongClass .requiredMethodRef(nme.DIV , List (LongType ))
453
453
def Long_/ = Long_divR .symbol
454
454
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 )
456
456
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 )
458
458
def DoubleClass (implicit ctx : Context ) = DoubleType .symbol.asClass
459
459
460
460
lazy val BoxedUnitType : TypeRef = ctx.requiredClassRef(" scala.runtime.BoxedUnit" )
@@ -976,15 +976,17 @@ class Definitions {
976
976
977
977
private val boxedTypes = mutable.Map [TypeName , TypeRef ]()
978
978
private val valueTypeEnc = mutable.Map [TypeName , PrimitiveClassEnc ]()
979
+ private val typeTags = mutable.Map [TypeName , Name ]().withDefaultValue(nme.specializedTypeNames.Object )
979
980
980
981
// private val unboxedTypeRef = mutable.Map[TypeName, TypeRef]()
981
982
// private val javaTypeToValueTypeRef = mutable.Map[Class[_], TypeRef]()
982
983
// private val valueTypeNameToJavaType = mutable.Map[TypeName, Class[_]]()
983
984
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 = {
985
986
val vcls = ctx.requiredClassRef(name)
986
987
boxedTypes(vcls.name) = boxed
987
988
valueTypeEnc(vcls.name) = enc
989
+ typeTags(vcls.name) = tag
988
990
// unboxedTypeRef(boxed.name) = vcls
989
991
// javaTypeToValueTypeRef(jtype) = vcls
990
992
// valueTypeNameToJavaType(vcls.name) = jtype
@@ -994,6 +996,9 @@ class Definitions {
994
996
/** The type of the boxed class corresponding to primitive value type `tp`. */
995
997
def boxedType (tp : Type )(implicit ctx : Context ): TypeRef = boxedTypes(scalaClassName(tp))
996
998
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
+
997
1002
type PrimitiveClassEnc = Int
998
1003
999
1004
val ByteEnc = 2
0 commit comments