Types
Type members
Classlikes
An annotated type tpe @ annot
An annotated type tpe @ annot
- Companion
- object
A type application C[T_1, ..., T_n]
A type application C[T_1, ..., T_n]
- Companion
- object
A type map that approximates TypeBounds types depending on variance.
A type map that approximates TypeBounds types depending on variance.
if variance > 0 : approximate by upper bound variance < 0 : approximate by lower bound variance = 0 : propagate bounds to next outer level
A trait for types that bind other types that refer to them. Instances are: LambdaType, RecType.
A trait for types that bind other types that refer to them. Instances are: LambdaType, RecType.
Instances of this class are cached and are not proxies.
Instances of this class are cached and are not proxies.
Instances of this class are cached and are proxies.
Instances of this class are cached and are proxies.
Roughly: the info of a class during a period.
Roughly: the info of a class during a period.
- Value Params
- cls
The class symbol.
- declaredParents
The parent types of this class. These are all normalized to be TypeRefs by moving any refinements to be member definitions of the class itself. Unlike
parents
, the types are not seen as seen fromprefix
.- decls
The symbols defined directly in this class.
- prefix
The prefix on which parents, decls, and selfType need to be rebased.
- selfInfo
The type of
this
in this class, if explicitly given, NoType otherwise. If class is compiled from source, can also be a reference to the self symbol containing the type.
- Companion
- object
A type map that maps also parents and self type of a ClassInfo
A type map that maps also parents and self type of a ClassInfo
A by-name parameter type of the form => T
, or the type of a method with no parameter list.
A by-name parameter type of the form => T
, or the type of a method with no parameter list.
- Companion
- object
A common superclass of ErrorType
and TryDynamicCallSite
. Instances of this
class are at the same time subtypes and supertypes of every other type.
A common superclass of ErrorType
and TryDynamicCallSite
. Instances of this
class are at the same time subtypes and supertypes of every other type.
A type lambda of the form [X_0 B_0, ..., X_n B_n] => T
A type lambda of the form [X_0 B_0, ..., X_n B_n] => T
- Value Params
- paramInfosExp
A function that, given the polytype itself, returns the parameter bounds
B_1
, ...,B_n
- paramNames
The names
X_0
, ...,X_n
- resultTypeExp
A function that, given the polytype itself, returns the result type
T
.- variances
The variances of the type parameters, if the type lambda carries variances, i.e. it is a bound of an abstract type or the rhs of a match alias or opaque alias. The parameter is Nil for all other lambdas. Variances are stored in the
typeParams
list of the lambda.
- Companion
- object
A reference to an implicit definition. This can be either a TermRef or a Implicits.RenamedImplicitRef.
A reference to an implicit definition. This can be either a TermRef or a Implicits.RenamedImplicitRef.
The lambda type square:
The lambda type square:
LambdaType | TermLambda | TypeLambda -------------+-------------------+------------------ HKLambda | HKTermLambda | HKTypeLambda MethodOrPoly | MethodType | PolyType
= T where T
is a MatchType
= T where T
is a MatchType
Match aliases are treated differently from type aliases. Their sides are mutually subtypes of each other but one side is not generally substitutable for the other. If we assumed full substitutivity, we would have to reject all recursive match aliases (or else take the jump and allow full recursive types).
- Companion
- object
scrutinee match { case_1 ... case_n }
scrutinee match { case_1 ... case_n }
where
case_i = [X1, ..., Xn] patternType => resultType
and X_1,...X_n
are the type variables bound in patternType
- Companion
- object
- Companion
- object
A name filter selects or discards a member name of a type pre
.
To enable efficient caching, name filters have to satisfy the
following invariant: If keep
is a name filter, and pre
has
class C
as a base class, then
A name filter selects or discards a member name of a type pre
.
To enable efficient caching, name filters have to satisfy the
following invariant: If keep
is a name filter, and pre
has
class C
as a base class, then
keep(pre, name) implies keep(C.this, name)
Implementations of this trait cache the results of narrow
.
Implementations of this trait cache the results of narrow
.
An extractor object to pattern match against a nullable union. e.g.
An extractor object to pattern match against a nullable union. e.g.
(tp: Type) match
case OrNull(tp1) => // tp had the form tp1 | Null
case _ => // tp was not a nullable union
The type of a polymorphic method. It has the same form as HKTypeLambda, except it applies to terms and parameters do not have variances.
The type of a polymorphic method. It has the same form as HKTypeLambda, except it applies to terms and parameters do not have variances.
- Companion
- object
A trait for proto-types, used as expected types in typer
A trait for proto-types, used as expected types in typer
A skolem type used to wrap the type of the qualifier of a selection.
A skolem type used to wrap the type of the qualifier of a selection.
When typing a selection e.f
, if e
is unstable then we unconditionally
skolemize it. We use a subclass of SkolemType
for this so that
TypeOps#asSeenFrom may treat it specially for optimization purposes,
see its implementation for more details.
- Companion
- object
a self-reference to an enclosing recursive type. The only creation method is
binder.recThis
, returning RecThis(binder)
.
a self-reference to an enclosing recursive type. The only creation method is
binder.recThis
, returning RecThis(binder)
.
A recursive type. Instances should be constructed via the companion object.
A recursive type. Instances should be constructed via the companion object.
- Value Params
- parentExp
A function that, given a recursive type R, produces a type that can refer to R via a
RecThis(R)
node. This is used to "tie the knot". For example, in class C { type T1; type T2 } type C2 = C { type T1; type T2 = T1 } The type ofC2
is a recursive type{(x) => C{T1; T2 = x.T1}}
, written as RecType( RefinedType( RefinedType( TypeRef(...,class C), T1, TypeBounds(...)), T2, TypeBounds( TypeRef(RecThis(...),T1), TypeRef(RecThis(...),T1)))) WhereRecThis(...)
points back to the enclosingRecType
.
- Companion
- object
A refined type parent { refinement }
A refined type parent { refinement }
- Value Params
- parent
The type being refined
- refinedInfo
The info of the refinement declaration
- refinedName
The name of the refinement declaration
- Companion
- object
An extractor for single abstract method types. A type is a SAM type if it is a reference to a class or trait, which
An extractor for single abstract method types. A type is a SAM type if it is a reference to a class or trait, which
- has a single abstract method with a method type (ExprType and PolyType not allowed!) whose result type is not an implicit function type
- can be instantiated without arguments or with just () as argument.
The pattern SAMType(sam)
matches a SAM type, where sam
is the
type of the single abstract method.
A marker trait for types that are guaranteed to contain only a single non-null value (they might contain null in addition).
A marker trait for types that are guaranteed to contain only a single non-null value (they might contain null in addition).
A skolem type reference with underlying type info
.
A skolem type reference with underlying type info
.
For Dotty, a skolem type is a singleton type of some unknown value of type info
.
Note that care is needed when creating them, since not all types need to be inhabited.
A skolem is equal to itself and no other type.
The type of a super reference cls.super where
thistpe
is cls.this and supertpe
is the type of the value referenced
by super
.
The type of a super reference cls.super where
thistpe
is cls.this and supertpe
is the type of the value referenced
by super
.
- Companion
- object
A class for temporary class infos where parents
are not yet known
A class for temporary class infos where parents
are not yet known
Only created in binder.paramRefs
. Use binder.paramRefs(paramNum)
to
refer to TermParamRef(binder, paramNum)
.
Only created in binder.paramRefs
. Use binder.paramRefs(paramNum)
to
refer to TermParamRef(binder, paramNum)
.
The singleton type for path prefix#myDesignator.
The singleton type for path prefix#myDesignator.
- Companion
- object
A marker trait for types that apply only to term symbols or that represent higher-kinded types.
A marker trait for types that apply only to term symbols or that represent higher-kinded types.
The type cls.this
The type cls.this
- Value Params
- tref
A type ref which indicates the class
cls
. Note: we do not pass a class symbol directly, because symbols do not survive runs whereas typerefs do.
- Companion
- object
Main class representing types.
Main class representing types.
The principal subclasses and sub-objects are as follows:
Type -+- ProxyType --+- NamedType ----+--- TypeRef
| | \
| +- SingletonType-+-+- TermRef
| | |
| | +--- ThisType
| | +--- SuperType
| | +--- ConstantType
| | +--- TermParamRef
| | +----RecThis
| | +--- SkolemType
| +- TypeParamRef
| +- RefinedOrRecType -+-- RefinedType
| | -+-- RecType
| +- AppliedType
| +- TypeBounds
| +- ExprType
| +- AnnotatedType
| +- TypeVar
| +- HKTypeLambda
| +- MatchType
|
+- GroundType -+- AndType
+- OrType
+- MethodOrPoly ---+-- PolyType
| +-- MethodType
+- ClassInfo
|
+- NoType
+- NoPrefix
+- ErrorType
+- WildcardType
Note: please keep in sync with copy in docs/docs/internals/type-system.md
.
Only created in binder.paramRefs
. Use binder.paramRefs(paramNum)
to
refer to TypeParamRef(binder, paramNum)
.
Only created in binder.paramRefs
. Use binder.paramRefs(paramNum)
to
refer to TypeParamRef(binder, paramNum)
.
A marker trait for type proxies.
Each implementation is expected to redefine the underlying
method.
A marker trait for type proxies.
Each implementation is expected to redefine the underlying
method.
A marker trait for types that apply only to type symbols
A marker trait for types that apply only to type symbols
In a TypeApply tree, a TypeVar is created for each argument type to be inferred. Every type variable is referred to by exactly one inferred type parameter of some TypeApply tree.
In a TypeApply tree, a TypeVar is created for each argument type to be inferred. Every type variable is referred to by exactly one inferred type parameter of some TypeApply tree.
A type variable is essentially a switch that models some part of a substitution.
It is first linked to origin
, a poly param that's in the current constraint set.
It can then be (once) instantiated to some other type. The instantiation is
recorded in the type variable itself, or else, if the current type state
is different from the variable's creation state (meaning unrolls are possible)
in the current typer state.
- Value Params
- creatorState
The typer state in which the variable was created.
- origin
The parameter that's tracked by the type variable.
- Companion
- object
Instances of this class are uncached and are not proxies.
Instances of this class are uncached and are not proxies.
Instances of this class are uncached and are proxies.
Instances of this class are uncached and are proxies.
A marker trait for types that can be types of values or that are higher-kinded
A marker trait for types that can be types of values or that are higher-kinded
A marker trait for types that can be types of values or prototypes of value types
A marker trait for types that can be types of values or prototypes of value types
Common base class of TypeMap and TypeAccumulator
Common base class of TypeMap and TypeAccumulator
A filter for names of deferred term definitions of a given type
A filter for names of deferred term definitions of a given type
A filter for names of abstract types of a given type
A filter for names of abstract types of a given type
A filter for names of abstract types of a given type
A filter for names of abstract types of a given type