Dotty Documentation

0.14.0-bin-SNAPSHOT

trait TypeOps
extends Object

[-] Constructors

[-] Members

[+] class AsSeenFromMap

The TypeMap handling the asSeenFrom

[+] class SimplifyMap
[+] type BoundsViolation = ( Tree, String, Type )

An argument bounds violation is a triple consisting of - the argument tree - a string "upper" or "lower" indicating which bound is violated - the violated bound

[+] final def asSeenFrom ( tp: Type , pre: Type , cls: Symbol ) : Type

The type tp as seen from prefix pre and owner cls. See the spec for what this means.

[+] def boundsViolations ( args: List [ Tree ] , boundss: List [ TypeBounds ] , instantiate: (Type, List [ Type ]) => Type ) ( implicit ctx: Context ) : List [ BoundsViolation ]

The list of violations where arguments are not within bounds.

[+] def canAutoTuple : Boolean

Is auto-tupling enabled?

[+] def dynamicsEnabled : Boolean
[+] def featureEnabled ( owner: ClassSymbol , feature: TermName ) : Boolean

Is feature enabled in class owner? This is the case if one of the following two alternatives holds:

  1. The feature is imported by a named import

    import owner.feature

    and there is no visible nested import that excludes the feature, as in

    import owner.{ feature => _ }

The feature may be bunched with others, or renamed, but wildcard imports don't count.

  1. The feature is enabled by a compiler option

    • language:feature

where is the full name of the owner followed by a "." minus the prefix "dotty.language.".

[+] def inInlineMethod : Boolean

Are we in an inline method body?

[+] private def instantiate ( tp1: NamedType , tp2: Type ) ( implicit ctx: Context ) : Type

Instantiate type tp1 to be a subtype of tp2

Return the instantiated type if type parameters and this type in tp1 can be instantiated such that tp1 <:< tp2.

Otherwise, return NoType.

[+] private def isLegalPrefix ( pre: Type ) ( implicit ctx: Context ) : Boolean
[+] def makePackageObjPrefixExplicit ( tpe: NamedType ) : Type

If tpe is of the form p.x where p refers to a package but x is not owned by a package, expand it to

p.package.x
[+] def orDominator ( tp: Type ) : Type

Approximate union type by intersection of its dominators. That is, replace a union type Tn | ... | Tn by the smallest intersection type of base-class instances of T1,...,Tn. Example: Given

trait C[+T]
trait D
class A extends C[A] with D
class B extends C[B] with D with E

we approximate A | B by C[A | B] with D

[+] def refineUsingParent ( parent: Type , child: Symbol ) ( implicit ctx: Context ) : Type

Refine child based on parent

In child class definition, we have:

class Child[Ts] extends path.Parent[Us] with Es
object Child extends path.Parent[Us] with Es
val child = new path.Parent[Us] with Es           // enum values

Given a parent type parent and a child symbol child, we infer the prefix and type parameters for the child:

prefix.child[Vs] <:< parent

where Vs are fresh type variables and prefix is the symbol prefix with all non-module and non-package ThisType replaced by fresh type variables.

If the subtyping is true, the instantiated type p.child[Vs] is returned. Otherwise, NoType is returned.

[+] def scala2Mode : Boolean
[+] def scala2Setting : Boolean

Is option -language:Scala2 set? This test is used when we are too early in the pipeline to consider imports.

[+] final def simplify ( tp: Type , theMap: SimplifyMap ) : Type

Implementation of Types#simplified

[+] def testScala2Mode ( msg: => Message , pos: SourcePosition , replace: => Unit ) : Boolean
[+] def testScala2Mode$default$3 : Unit