aboutsummaryrefslogblamecommitdiff
path: root/src/dotty/tools/dotc/transform/TypeUtils.scala
blob: 109a04af38948a6adfb38e96f15d1f8d4968437f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12


                        
             
                                  






                                   


                                                                           
 

 

                                                

                                                
 




                                                            
 
package dotty.tools.dotc
package transform

import core._
import TypeErasure.ErasedValueType
import Types._
import Contexts._
import Symbols._
import Decorators._
import StdNames.nme
import NameOps._
import language.implicitConversions

object TypeUtils {
  implicit def decorateTypeUtils(tpe: Type): TypeUtils = new TypeUtils(tpe)

}

/** A decorator that provides methods on types
 *  that are needed in the transformer pipeline.
 */
class TypeUtils(val self: Type) extends AnyVal {

  def isErasedValueType(implicit ctx: Context): Boolean =
    self.isInstanceOf[ErasedValueType]

  def isPrimitiveValueType(implicit ctx: Context): Boolean =
    self.classSymbol.isPrimitiveValueClass
}