Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8978ae6
First versions of Definitions based on TypeRefs not Symbols.
odersky Nov 7, 2015
02164c3
Index primitive value class maps by name, not TypeRef
odersky Nov 7, 2015
0db1043
Harmonize naming conventions for BoxedUnit
odersky Nov 7, 2015
3254690
Make isPolymorphicAfterErasure a method
odersky Nov 7, 2015
687dec1
Use more standard way to define LanguageModuleClass
odersky Nov 7, 2015
23be0fd
Standardize naming and definition order of annotation classes
odersky Nov 7, 2015
a2c1d2a
Standardize requiredMethod calls
odersky Nov 7, 2015
d7424c0
Match on _name rather than TypeRef in scalaPrimitives
odersky Nov 7, 2015
33b284f
Make BoxedUnit_UNIT a def
odersky Nov 7, 2015
dfca53e
Move refType/Class maps from Definitions to CapturedVars
odersky Nov 7, 2015
bf38d8c
Remove/hide value class maps
odersky Nov 7, 2015
5db52d2
Make Set[TypeRef]s private
odersky Nov 7, 2015
5398c5a
Avoid overhead of generating symbol sets on each access
odersky Nov 7, 2015
af6ffc3
Renamings in Definitions
odersky Nov 7, 2015
2d7a05f
Fix dotty compilation problem in Definitions
odersky Nov 7, 2015
4f01f62
Shorten ..Class.typeRef to ..Type
odersky Nov 8, 2015
a1bd4dc
Rename AnnotRef -> AnnotType
odersky Nov 8, 2015
e8687d6
Make symbol methods in Definitions depend on implicit context
odersky Nov 8, 2015
f93167d
Don't try to transform sources of primitive value classes after Front…
odersky Nov 8, 2015
27e65ef
Enable compilation of primitive types.
odersky Nov 8, 2015
820bd7e
Avoid taking references before toplevel symbols are entered.
odersky Nov 8, 2015
0e14e70
Generalize MultiArrayOf to arrays of wildcards
odersky Nov 8, 2015
224637c
Disable "Exception while typing" trace in retyper.
odersky Nov 8, 2015
4007e71
More refined Retyping tracing
odersky Nov 8, 2015
1377155
Make dir.list synchronized.
odersky Nov 8, 2015
02f0c79
Trying to get more diagnostics out of TreeChecker
odersky Nov 8, 2015
9fe9865
More info when TreeChecker fails
odersky Nov 9, 2015
e8b07a3
Better diagnosis from completions printer
odersky Nov 9, 2015
b23c6b8
Don't inspect info when dealiasing classes
odersky Nov 9, 2015
581960a
Avoid cyclic reference errors when unpickling classes
odersky Nov 9, 2015
b112b2b
Print missing ref diagnostics on stderr
odersky Nov 9, 2015
949c48e
Get more info on Heisenbugs
odersky Nov 9, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/dotty/tools/backend/jvm/CollectEntryPoints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ class CollectEntryPoints extends MiniPhaseTransform {

object CollectEntryPoints{
def isJavaMainMethod(sym: Symbol)(implicit ctx: Context) = {
val d = ctx.definitions
val StringType = d.StringType

(sym.name == nme.main) && (sym.info match {
case r@MethodType(_, List(d.ArrayType(t))) =>
(t.widenDealias =:= StringType) && (
r.resultType.widenDealias =:= d.UnitType)
case r@MethodType(_, List(defn.ArrayOf(t))) =>
(t.widenDealias =:= defn.StringType) && (
r.resultType.widenDealias =:= defn.UnitType)
case _ => false
})
}
Expand Down
22 changes: 9 additions & 13 deletions src/dotty/tools/backend/jvm/DottyBackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
val nme_PACKAGE: Name = StdNames.nme.PACKAGE
val nme_EQEQ_LOCAL_VAR: Name = StdNames.nme.EQEQ_LOCAL_VAR

val BoxesRunTimeModule = ctx.requiredModule("scala.runtime.BoxesRunTime")
val BoxesRunTimeClass = toDenot(BoxesRunTimeModule).moduleClass.asClass

// require LambdaMetafactory: scalac uses getClassIfDefined, but we need those always.
override lazy val LambdaMetaFactory = ctx.requiredClass("java.lang.invoke.LambdaMetafactory")
override lazy val MethodHandle = ctx.requiredClass("java.lang.invoke.MethodHandle")
Expand Down Expand Up @@ -133,29 +130,28 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
}

val hashMethodSym: Symbol = NoSymbol // used to dispatch ## on primitives to ScalaRuntime.hash. Should be implemented by a miniphase
val externalEqualsNumNum: Symbol = ctx.requiredMethod(BoxesRunTimeClass, nme.equalsNumNum)
lazy val externalEqualsNumChar: Symbol = ??? // ctx.requiredMethod(BoxesRunTimeClass, nme.equalsNumChar) // this method is private
val externalEqualsNumObject: Symbol = ctx.requiredMethod(BoxesRunTimeClass, nme.equalsNumObject)
val externalEquals: Symbol = BoxesRunTimeClass.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol
val externalEqualsNumNum: Symbol = defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum)
lazy val externalEqualsNumChar: Symbol = ??? // ctx.requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
val externalEqualsNumObject: Symbol = defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject)
val externalEquals: Symbol = defn.BoxesRunTimeClass.info.decl(nme.equals_).suchThat(toDenot(_).info.firstParamTypes.size == 2).symbol
val MaxFunctionArity: Int = Definitions.MaxFunctionArity
val FunctionClass: Array[Symbol] = defn.FunctionClass.asInstanceOf[Array[Symbol]]
val AbstractFunctionClass: Array[Symbol] = defn.AbstractFunctionClass.asInstanceOf[Array[Symbol]]
val FunctionClass: Array[Symbol] = defn.FunctionClassPerRun()
val AbstractFunctionClass: Array[Symbol] = defn.AbstractFunctionClassPerRun()
val PartialFunctionClass: Symbol = defn.PartialFunctionClass
val AbstractPartialFunctionClass: Symbol = defn.AbstractPartialFunctionClass
val String_valueOf: Symbol = defn.String_valueOf_Object
lazy val Predef_classOf: Symbol = ctx.requiredMethod(toDenot(defn.ScalaPredefModule).moduleClass.asClass, nme.classOf)
lazy val Predef_classOf: Symbol = defn.ScalaPredefModule.requiredMethod(nme.classOf)

lazy val AnnotationRetentionAttr = ctx.requiredClass("java.lang.annotation.Retention")
lazy val AnnotationRetentionSourceAttr = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE")
lazy val AnnotationRetentionClassAttr = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS")
lazy val AnnotationRetentionRuntimeAttr = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME")
lazy val JavaAnnotationClass = ctx.requiredClass("java.lang.annotation.Annotation")


def boxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses.map{x =>
def boxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses().map{x => // @darkdimius Are you sure this should be a def?
(x, Erasure.Boxing.boxMethod(x.asClass))
}.toMap
def unboxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses.map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap
def unboxMethods: Map[Symbol, Symbol] = defn.ScalaValueClasses().map(x => (x, Erasure.Boxing.unboxMethod(x.asClass))).toMap

private val mkArrayNames: Set[Name] = Set("Byte", "Float", "Char", "Double", "Boolean", "Unit", "Long", "Int", "Short", "Ref").map{ x=>
("new" + x + "Array").toTermName
Expand Down
62 changes: 31 additions & 31 deletions src/dotty/tools/backend/jvm/scalaPrimitives.scala
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DottyPrimitives(ctx: Context) {
}

def elementType: Type = tpe.widenDealias match {
case defn.ArrayType(el) => el
case defn.ArrayOf(el) => el
case JavaArrayType(el) => el
case _ =>
ctx.error(s"expected Array $tpe")
Expand All @@ -79,42 +79,42 @@ class DottyPrimitives(ctx: Context) {
code match {

case APPLY =>
elementType.classSymbol match {
case defn.BooleanClass => ZARRAY_GET
case defn.ByteClass => BARRAY_GET
case defn.ShortClass => SARRAY_GET
case defn.CharClass => CARRAY_GET
case defn.IntClass => IARRAY_GET
case defn.LongClass => LARRAY_GET
case defn.FloatClass => FARRAY_GET
case defn.DoubleClass => DARRAY_GET
case _ => OARRAY_GET
defn.scalaClassName(elementType) match {
case tpnme.Boolean => ZARRAY_GET
case tpnme.Byte => BARRAY_GET
case tpnme.Short => SARRAY_GET
case tpnme.Char => CARRAY_GET
case tpnme.Int => IARRAY_GET
case tpnme.Long => LARRAY_GET
case tpnme.Float => FARRAY_GET
case tpnme.Double => DARRAY_GET
case _ => OARRAY_GET
}

case UPDATE =>
elementType.classSymbol match {
case defn.BooleanClass => ZARRAY_SET
case defn.ByteClass => BARRAY_SET
case defn.ShortClass => SARRAY_SET
case defn.CharClass => CARRAY_SET
case defn.IntClass => IARRAY_SET
case defn.LongClass => LARRAY_SET
case defn.FloatClass => FARRAY_SET
case defn.DoubleClass => DARRAY_SET
case _ => OARRAY_SET
defn.scalaClassName(elementType) match {
case tpnme.Boolean => ZARRAY_SET
case tpnme.Byte => BARRAY_SET
case tpnme.Short => SARRAY_SET
case tpnme.Char => CARRAY_SET
case tpnme.Int => IARRAY_SET
case tpnme.Long => LARRAY_SET
case tpnme.Float => FARRAY_SET
case tpnme.Double => DARRAY_SET
case _ => OARRAY_SET
}

case LENGTH =>
elementType.classSymbol match {
case defn.BooleanClass => ZARRAY_LENGTH
case defn.ByteClass => BARRAY_LENGTH
case defn.ShortClass => SARRAY_LENGTH
case defn.CharClass => CARRAY_LENGTH
case defn.IntClass => IARRAY_LENGTH
case defn.LongClass => LARRAY_LENGTH
case defn.FloatClass => FARRAY_LENGTH
case defn.DoubleClass => DARRAY_LENGTH
case _ => OARRAY_LENGTH
defn.scalaClassName(elementType) match {
case tpnme.Boolean => ZARRAY_LENGTH
case tpnme.Byte => BARRAY_LENGTH
case tpnme.Short => SARRAY_LENGTH
case tpnme.Char => CARRAY_LENGTH
case tpnme.Int => IARRAY_LENGTH
case tpnme.Long => LARRAY_LENGTH
case tpnme.Float => FARRAY_LENGTH
case tpnme.Double => DARRAY_LENGTH
case _ => OARRAY_LENGTH
}

case _ =>
Expand Down
5 changes: 3 additions & 2 deletions src/dotty/tools/dotc/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import core._
import Contexts._
import Periods._
import Symbols._
import Types._
import Scopes._
import typer.{FrontEnd, Typer, Mode, ImportInfo, RefChecks}
import reporting.{Reporter, ConsoleReporter}
Expand Down Expand Up @@ -111,8 +112,8 @@ class Compiler {
.setMode(Mode.ImplicitsEnabled)
.setTyperState(new MutableTyperState(ctx.typerState, rootReporter(ctx), isCommittable = true))
ctx.definitions.init(start) // set context of definitions to start
def addImport(ctx: Context, symf: () => Symbol) =
ctx.fresh.setImportInfo(ImportInfo.rootImport(symf)(ctx))
def addImport(ctx: Context, refFn: () => TermRef) =
ctx.fresh.setImportInfo(ImportInfo.rootImport(refFn)(ctx))
(start.setRunInfo(new RunInfo(start)) /: defn.RootImportFns)(addImport)
}

Expand Down
16 changes: 8 additions & 8 deletions src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ object desugar {

def anyRef = ref(defn.AnyRefAlias.typeRef)
def productConstr(n: Int) = {
val tycon = ref(defn.ProductNClass(n).typeRef)
val tycon = scalaDot((tpnme.Product.toString + n).toTypeName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could defn.ProductNType(n) be used here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it would load the class. That's what caused the datarace after all.

val targs = constrVparamss.head map (_.tpt)
if (targs.isEmpty) tycon else AppliedTypeTree(tycon, targs)
}
Expand Down Expand Up @@ -803,10 +803,10 @@ object desugar {
makeBinop(l, op, r)
case PostfixOp(t, op) =>
if ((ctx.mode is Mode.Type) && op == nme.raw.STAR) {
val seqClass = if (ctx.compilationUnit.isJava) defn.ArrayClass else defn.SeqClass
val seqType = if (ctx.compilationUnit.isJava) defn.ArrayType else defn.SeqType
Annotated(
New(ref(defn.RepeatedAnnot.typeRef), Nil :: Nil),
AppliedTypeTree(ref(seqClass.typeRef), t))
New(ref(defn.RepeatedAnnotType), Nil :: Nil),
AppliedTypeTree(ref(seqType), t))
} else {
assert(ctx.mode.isExpr || ctx.reporter.hasErrors, ctx.mode)
Select(t, op)
Expand All @@ -818,22 +818,22 @@ object desugar {
case Tuple(ts) =>
if (unboxedPairs) {
def PairTypeTree(l: Tree, r: Tree) =
AppliedTypeTree(ref(defn.PairClass.typeRef), l :: r :: Nil)
AppliedTypeTree(ref(defn.PairType), l :: r :: Nil)
if (ctx.mode is Mode.Type) ts.reduceRight(PairTypeTree)
else if (ts.isEmpty) unitLiteral
else ts.reduceRight(Pair(_, _))
}
else {
val arity = ts.length
def tupleClass = defn.TupleClass(arity)
def tupleTypeRef = defn.TupleType(arity)
if (arity > Definitions.MaxTupleArity) {
ctx.error(s"tuple too long (max allowed: ${Definitions.MaxTupleArity})", tree.pos)
unitLiteral
}
else if (arity == 1) ts.head
else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleClass.typeRef), ts)
else if (ctx.mode is Mode.Type) AppliedTypeTree(ref(tupleTypeRef), ts)
else if (arity == 0) unitLiteral
else Apply(ref(tupleClass.companionModule.valRef), ts)
else Apply(ref(tupleTypeRef.classSymbol.companionModule.valRef), ts)
}
case WhileDo(cond, body) =>
// { <label> def while$(): Unit = if (cond) { body; while$() } ; while$() }
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/TreeInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>

/** Does this CaseDef catch Throwable? */
def catchesThrowable(cdef: CaseDef)(implicit ctx: Context) =
catchesAllOf(cdef, defn.ThrowableClass.typeRef)
catchesAllOf(cdef, defn.ThrowableType)

/** Does this CaseDef catch everything of a certain Type? */
def catchesAllOf(cdef: CaseDef, threshold: Type)(implicit ctx: Context) =
Expand Down
34 changes: 27 additions & 7 deletions src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dotty.tools
package dotc
package ast

import dotty.tools.dotc.transform.ExplicitOuter
import dotty.tools.dotc.transform.{ExplicitOuter, Erasure}
import dotty.tools.dotc.typer.ProtoTypes.FunProtoTyped
import transform.SymUtils._
import core._
Expand All @@ -13,7 +13,6 @@ import config.Printers._
import typer.Mode
import collection.mutable
import typer.ErrorReporting._
import transform.Erasure

import scala.annotation.tailrec

Expand Down Expand Up @@ -268,7 +267,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def AnonClass(parents: List[Type], fns: List[TermSymbol], methNames: List[TermName])(implicit ctx: Context): Block = {
val owner = fns.head.owner
val parents1 =
if (parents.head.classSymbol.is(Trait)) defn.ObjectClass.typeRef :: parents
if (parents.head.classSymbol.is(Trait)) defn.ObjectType :: parents
else parents
val cls = ctx.newNormalizedClassSymbol(owner, tpnme.ANON_FUN, Synthetic, parents1,
coord = fns.map(_.pos).reduceLeft(_ union _))
Expand Down Expand Up @@ -376,7 +375,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
newArr(elemClass.name.toString)
else
newArr("Ref").appliedToTypeTrees(
TypeTree(defn.ArrayType(elemType)).withPos(typeArg.pos) :: Nil)
TypeTree(defn.ArrayOf(elemType)).withPos(typeArg.pos) :: Nil)
}

// ------ Creating typed equivalents of trees that exist only in untyped form -------
Expand Down Expand Up @@ -778,6 +777,27 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
}
else Assign(tree, rhs)

/** A tree in place of this tree that represents the class of type `tp`.
* Contains special handling if the class is a primitive value class
* and invokes a `default` method otherwise.
*/
def clsOf(tp: Type, default: => Tree)(implicit ctx: Context): Tree = {
def TYPE(module: TermSymbol) =
ref(module).select(nme.TYPE_).ensureConforms(tree.tpe).withPos(tree.pos)
defn.scalaClassName(tp) match {
case tpnme.Boolean => TYPE(defn.BoxedBooleanModule)
case tpnme.Byte => TYPE(defn.BoxedByteModule)
case tpnme.Short => TYPE(defn.BoxedShortModule)
case tpnme.Char => TYPE(defn.BoxedCharModule)
case tpnme.Int => TYPE(defn.BoxedIntModule)
case tpnme.Long => TYPE(defn.BoxedLongModule)
case tpnme.Float => TYPE(defn.BoxedFloatModule)
case tpnme.Double => TYPE(defn.BoxedDoubleModule)
case tpnme.Unit => TYPE(defn.BoxedUnitModule)
case _ => default
}
}

// --- Higher order traversal methods -------------------------------

/** Apply `f` to each subtree of this tree */
Expand Down Expand Up @@ -843,14 +863,14 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
val defn = ctx.definitions
val prefix = args.take(selected.widen.paramTypess.head.size - 1)
expectedType match {
case defn.ArrayType(el) =>
case defn.ArrayOf(el) =>
lastParam.tpe match {
case defn.ArrayType(el2) if el2 <:< el =>
case defn.ArrayOf(el2) if el2 <:< el =>
// we have a JavaSeqLiteral with a more precise type
// we cannot construct a tree as JavaSeqLiteral infered to precise type
// if we add typed than it would be both type-correct and
// will pass Ycheck
prefix ::: List(tpd.Typed(lastParam, TypeTree(defn.ArrayType(el))))
prefix ::: List(tpd.Typed(lastParam, TypeTree(defn.ArrayOf(el))))
case _ =>
???
}
Expand Down
4 changes: 3 additions & 1 deletion src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
def ref(tp: NamedType)(implicit ctx: Context): Tree =
TypedSplice(tpd.ref(tp))

def scalaUnit(implicit ctx: Context) = ref(defn.UnitClass.typeRef)
def rootDot(name: Name) = Select(Ident(nme.ROOTPKG), name)
def scalaDot(name: Name) = Select(rootDot(nme.scala_), name)
def scalaUnit = scalaDot(tpnme.Unit)

def makeConstructor(tparams: List[TypeDef], vparamss: List[List[ValDef]], rhs: Tree = EmptyTree)(implicit ctx: Context): DefDef =
DefDef(nme.CONSTRUCTOR, tparams, vparamss, TypeTree(), rhs)
Expand Down
6 changes: 2 additions & 4 deletions src/dotty/tools/dotc/config/JavaPlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ class JavaPlatform extends Platform {
}

// The given symbol is a method with the right name and signature to be a runnable java program.
def isJavaMainMethod(sym: SymDenotation)(implicit ctx: Context) = {
val dn = defn
def isJavaMainMethod(sym: SymDenotation)(implicit ctx: Context) =
(sym.name == nme.main) && (sym.info match {
case t@MethodType(_, dn.ArrayType(el) :: Nil) => el =:= defn.StringType && (t.resultType isRef defn.UnitClass)
case t@MethodType(_, defn.ArrayOf(el) :: Nil) => el =:= defn.StringType && (t.resultType isRef defn.UnitClass)
case _ => false
})
}

// The given class has a main method.
def hasJavaMainMethod(sym: Symbol)(implicit ctx: Context): Boolean =
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/config/Printers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ object Printers {
val implicitsDetailed: Printer = noPrinter
val subtyping: Printer = noPrinter
val unapp: Printer = noPrinter
val completions = noPrinter
val gadts = noPrinter
val hk = noPrinter
val variances = noPrinter
val incremental = noPrinter
val config = noPrinter
val transforms = noPrinter
val completions = noPrinter
val cyclicErrors = noPrinter
val pickling = noPrinter
}
4 changes: 2 additions & 2 deletions src/dotty/tools/dotc/core/Annotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ object Annotations {

def makeChild(sym: Symbol)(implicit ctx: Context) =
deferred(defn.ChildAnnot,
implicit ctx => New(defn.ChildAnnot.typeRef.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil))
implicit ctx => New(defn.ChildAnnotType.appliedTo(sym.owner.thisType.select(sym.name, sym)), Nil))
}

def ThrowsAnnotation(cls: ClassSymbol)(implicit ctx: Context) = {
val tref = cls.typeRef
Annotation(defn.ThrowsAnnot.typeRef.appliedTo(tref), Ident(tref))
Annotation(defn.ThrowsAnnotType.appliedTo(tref), Ident(tref))
}

/** A decorator that provides queries for specific annotations
Expand Down
22 changes: 11 additions & 11 deletions src/dotty/tools/dotc/core/Constants.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ object Constants {
def isAnyVal = UnitTag <= tag && tag <= DoubleTag

def tpe(implicit ctx: Context): Type = tag match {
case UnitTag => defn.UnitClass.typeRef
case BooleanTag => defn.BooleanClass.typeRef
case ByteTag => defn.ByteClass.typeRef
case ShortTag => defn.ShortClass.typeRef
case CharTag => defn.CharClass.typeRef
case IntTag => defn.IntClass.typeRef
case LongTag => defn.LongClass.typeRef
case FloatTag => defn.FloatClass.typeRef
case DoubleTag => defn.DoubleClass.typeRef
case StringTag => defn.StringClass.typeRef
case NullTag => defn.NullClass.typeRef
case UnitTag => defn.UnitType
case BooleanTag => defn.BooleanType
case ByteTag => defn.ByteType
case ShortTag => defn.ShortType
case CharTag => defn.CharType
case IntTag => defn.IntType
case LongTag => defn.LongType
case FloatTag => defn.FloatType
case DoubleTag => defn.DoubleType
case StringTag => defn.StringType
case NullTag => defn.NullType
case ClazzTag => defn.ClassType(typeValue)
case EnumTag => defn.EnumType(symbolValue)
}
Expand Down
Loading