A type carrying some annotations.
The API that all annotated types support
An extractor class to create and pattern match with syntax
AnnotatedType(annotations, underlying, selfsym)
.
A class remembering a type instantiation for some a set of overloaded polymorphic symbols.
Precondition: zipped params/args nonEmpty.
A map to compute the asSeenFrom method
BoundedWildcardTypes, used only during type inference, are created in two places that I can find:
The API that all this types support
A class representing a class info
The API that all class info types support
An extractor class to create and pattern match with syntax ClassInfo(parents, decls, clazz)
Here, parents
is the list of parent types of the class, decls
is the scope
containing all declarations in the class, and clazz
is the symbol of the class
itself.
A map to implement the collect
method.
A common base class for intersection types and class types
A class representing a constant type.
The API that all constant types support
An extractor class to create and pattern match with syntax ConstantType(constant)
Here, constant
is the constant value represented by the type.
A map to implement the contains
method.
A map to implement the contains
method.
A binder defining data associated with De Bruijn indices.
A De Bruijn index referring to a previous type argument.
Used by existentialAbstraction.
.
The API that all existential types support
An extractor class to create and pattern match with syntax
ExistentialType(quantified, underlying)
.
A map to implement the filter
method.
A map to implement the filter
method.
Precondition: params.
A class representing an as-yet unevaluated type.
A throwable signalling a malformed type
A class representing a method type with parameters.
The API that all method types support
An extractor class to create and pattern match with syntax MethodType(params, respte)
Here, params
is a potentially empty list of parameter symbols of the method,
and restpe
is the result type of the method.
A class representing types with a name.
.
The API that all nullary method types support
An extractor class to create and pattern match with syntax NullaryMethodType(resultType)
.
A class containing the alternatives and type prefix of an overloaded symbol.
A type function or the type of a polymorphic value (and thus of kind *).
The API that all polymorphic types support
An extractor class to create and pattern match with syntax PolyType(typeParams, resultType)
.
An exception for cyclic references from which we can recover
A class representing intersection types with refinements of the form
<parents_0> with ... with <parents_n> { decls }
Cannot be created directly;
one should always use refinedType
for creation.
The API that all refined types support
An extractor class to create and pattern match with syntax RefinedType(parents, decls)
Here, parents
is the list of parent types of the class, and decls
is the scope
containing all declarations in the class.
A proxy for a type (identified by field underlying
) that forwards most
operations to it.
A proxy for a type (identified by field underlying
) that forwards most
operations to it (for exceptions, see WrappingProxy, which forwards even more operations).
A class for singleton types of the form <prefix>.<sym.name>.type
.
The API that all single types support
An extractor class to create and pattern match with syntax SingleType(pre, sym)
Here, pre
is the prefix of the single-type, and sym
is the stable value symbol
referred to by the single-type.
A base class for types that represent a single value (single-types and this-types).
A base class for types that defer some operations to their immediate supertype.
A base class to compute all substitutions
A map to implement the substSym
method.
A map to implement the substThis
method.
A map to implement the subst
method.
.
The API that all super types support
An extractor class to create and pattern match with syntax SingleType(thistpe, supertpe)
A class for this-types of the form <sym>.
The API that all this types support
An extractor class to create and pattern match with syntax ThisType(sym)
where sym
is the class prefix of the this type.
The base class for all types
The extended API of types
The base API that all types support
A class for the bounds of abstract types and type parameters
The API that all type bounds support
An extractor class to create and pattern match with syntax TypeBound(lower, upper)
Here, lower
is the lower bound of the TypeBounds
pair, and upper
is
the upper bound.
A class expressing upper and lower bounds constraints of type variables, as well as their instantiations.
A throwable signalling a type error
A prototype for mapping a function over all possible types
A class for named types of the form
<prefix>.<sym.name>[args]
Cannot be created directly; one should always use typeRef
for creation.
The API that all type refs support
An extractor class to create and pattern match with syntax TypeRef(pre, sym, args)
Here, pre
is the prefix of the type reference, sym
is the symbol
referred to by the type reference, and args
is a possible empty list of
type argumenrts.
A class representing a type variable: not used after phase typer
.
Test two objects for inequality.
Test two objects for inequality.
true
if !(this == that), false otherwise.
Equivalent to x.hashCode
except for boxed numeric types and null
.
Equivalent to x.hashCode
except for boxed numeric types and null
.
For numerics, it returns a hash value which is consistent
with value equality: if two value type instances compare
as true, then ## will produce the same hash value for each
of them.
For null
returns a hashcode where null.hashCode
throws a
NullPointerException
.
a hash value consistent with ==
Test two objects for equality.
Test two objects for equality.
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
true
if the receiver object is equivalent to the argument; false
otherwise.
The constructor/deconstructor for AnnotatedType
instances.
A tag that preserves the identity of the AnnotatedType
abstract type from erasure.
A tag that preserves the identity of the BoundedWildcardType
abstract type from erasure.
The constructor/deconstructor for ClassInfoType
instances.
A tag that preserves the identity of the ClassInfoType
abstract type from erasure.
A tag that preserves the identity of the CompoundType
abstract type from erasure.
The constructor/deconstructor for ConstantType
instances.
A tag that preserves the identity of the ConstantType
abstract type from erasure.
A map to implement the contains
method.
An object representing an erroneous type
The constructor/deconstructor for ExistentialType
instances.
A tag that preserves the identity of the ExistentialType
abstract type from erasure.
A creator and extractor for type parameterizations that strips empty type parameter lists.
The canonical creator for implicit method types
The constructor/deconstructor for MethodType
instances.
A tag that preserves the identity of the MethodType
abstract type from erasure.
An object representing a non-existing prefix
An object representing a non-existing type
The constructor/deconstructor for NullaryMethodType
instances.
A tag that preserves the identity of the NullaryMethodType
abstract type from erasure.
The constructor/deconstructor for PolyType
instances.
A tag that preserves the identity of the PolyType
abstract type from erasure.
The constructor/deconstructor for RefinedType
instances.
A tag that preserves the identity of the RefinedType
abstract type from erasure.
The constructor/deconstructor for SingleType
instances.
A tag that preserves the identity of the SingleType
abstract type from erasure.
A tag that preserves the identity of the SingletonType
abstract type from erasure.
The constructor/deconstructor for SuperType
instances.
A tag that preserves the identity of the SuperType
abstract type from erasure.
The constructor/deconstructor for ThisType
instances.
A tag that preserves the identity of the ThisType
abstract type from erasure.
The constructor/deconstructor for TypeBounds
instances.
A tag that preserves the identity of the TypeBounds
abstract type from erasure.
The constructor/deconstructor for TypeRef
instances.
A tag that preserves the identity of the TypeRef
abstract type from erasure.
A tag that preserves the identity of the Type
abstract type from erasure.
An object representing an unknown type, used during type inference.
Type with all top-level occurrences of abstract types replaced by their bounds
Make symbol sym
a member of scope tp.decls
where thistp
is the narrowed owner type of the scope.
Creator for AnnotatedTypes.
Creator for AnnotatedTypes. It returns the underlying type if annotations.isEmpty rather than walking into the assertion.
Very convenient.
A creator for type applications
A creator for existential types where the type arguments, rather than being applied directly, are interpreted as the upper bounds of unknown types.
A creator for existential types where the type arguments, rather than being applied directly, are interpreted as the upper bounds of unknown types. For instance if the type argument list given is List(AnyRefClass), the resulting type would be e.g. Set[_ <: AnyRef] rather than Set[AnyRef] .
Cast the receiver object to be of type T0
.
Cast the receiver object to be of type T0
.
Note that the success of a cast at runtime is modulo Scala's erasure semantics.
Therefore the expression 1.asInstanceOf[String]
will throw a ClassCastException
at
runtime, while the expression List(1).asInstanceOf[List[String]]
will not.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the requested type.
the receiver object.
if the receiver object is not an instance of the erasure of type T0
.
Does this type have a prefix that begins with a type variable, or is it a refinement type? For type prefixes that fulfil this condition, type selections with the same name of equal (wrt) =:= prefixes are considered equal wrt =:=
Create a copy of the receiver object.
Create a new MethodType of the same class as tp, i.
Create a new MethodType of the same class as tp, i.e. keep JavaMethodType
Remove any occurrences of type aliases from this type
Substitutes the empty scope for any non-empty decls in the type.
Remove any occurrence of type <singleton> from this type and its parents
Tests whether the argument (arg0
) is a reference to the receiver object (this
).
Tests whether the argument (arg0
) is a reference to the receiver object (this
).
The eq
method implements an equivalence relation on
non-null instances of AnyRef
, and has three additional properties:
x
and y
of type AnyRef
, multiple invocations of
x.eq(y)
consistently returns true
or consistently returns false
.x
of type AnyRef
, x.eq(null)
and null.eq(x)
returns false
.null.eq(null)
returns true
. When overriding the equals
or hashCode
methods, it is important to ensure that their behavior is
consistent with reference equality. Therefore, if two objects are references to each other (o1 eq o2
), they
should be equal to each other (o1 == o2
) and they should hash to the same value (o1.hashCode == o2.hashCode
).
true
if the argument is a reference to the receiver object; false
otherwise.
The equality method for reference types.
A creator for existential types.
A creator for existential types. This generates:
tpe1 where { tparams }
where tpe1
is the result of extrapolating tpe
wrt to tparams
.
Extrapolating means that type variables in tparams
occurring
in covariant positions are replaced by upper bounds, (minus any
SingletonClass markers), type variables in tparams
occurring in
contravariant positions are replaced by upper bounds, provided the
resulting type is legal wrt to stability, and does not contain any type
variable in tparams
.
The abstraction drops all type parameters that are not directly or
indirectly referenced by type tpe1
. If there are no remaining type
parameters, simply returns result type tpe
.
Perform operation p
on arguments tp1
, arg2
and print trace of computation.
Perform operation p
on arguments tp1
, arg2
and print trace of computation.
If option explaintypes
is set, print a subtype trace for op(found, required)
.
If option explaintypes
is set, print a subtype trace for found <:< required
.
Called by the garbage collector on the receiver object when there are no more references to the object.
Called by the garbage collector on the receiver object when there are no more references to the object.
The details of when and if the finalize
method is invoked, as
well as the interaction between finalize
and non-local returns
and exceptions, are all platform dependent.
From a list of types, find any which take type parameters where the type parameter bounds contain references to other any types in the list (including itself.
From a list of types, find any which take type parameters where the type parameter bounds contain references to other any types in the list (including itself.)
List of symbol pairs holding the recursive type parameter and the parameter which references it.
Returns string formatted according to given format
string.
Returns string formatted according to given format
string.
Format strings are as for String.format
(@see java.lang.String.format).
A representation that corresponds to the dynamic class of the receiver object.
A representation that corresponds to the dynamic class of the receiver object.
The nature of the representation is platform dependent.
a representation that corresponds to the dynamic class of the receiver object.
not specified by SLS as a member of AnyRef
The greatest lower bound wrt <:< of a list of types
The greatest lower bound wrt <:< of a list of types, which have been normalized wrt elimSuper
The greatest lower bound wrt <:< of a list of types, which have been normalized wrt elimSuper
Again avoiding calling length, but the lengthCompare interface is clunky.
The hashCode method for reference types.
A creator for intersection type where intersections of a single type are replaced by the type itself.
A creator for intersection type where intersections of a single type are replaced by the type itself, and repeated parent classes are merged.
A map from lists to compound types that have the given list as parents.
A map from lists to compound types that have the given list as parents. This is used to avoid duplication in the computation of base type sequences and baseClasses. It makes use of the fact that these two operations depend only on the parents, not on the refinement.
Test whether the dynamic type of the receiver object is T0
.
Test whether the dynamic type of the receiver object is T0
.
Note that the result of the test is modulo Scala's erasure semantics.
Therefore the expression 1.isInstanceOf[String]
will return false
, while the
expression List(1).isInstanceOf[List[String]]
will return true
.
In the latter example, because the type argument is erased as part of compilation it is
not possible to check whether the contents of the list are of the specified type.
true
if the receiver object is an instance of erasure of type T0
; false
otherwise.
The isNumericValueType tests appear redundant, but without them test/continuations-neg/function3.
The isNumericValueType tests appear redundant, but without them test/continuations-neg/function3.scala goes into an infinite loop. (Even if the calls are to typeSymbolDirect.)
Is intersection of given types populated? That is, for all types tp1, tp2 in intersection for all common base classes bc of tp1 and tp2 let bt1, bt2 be the base types of tp1, tp2 relative to class bc Then: bt1 and bt2 have the same prefix, and any corresponding non-variant type arguments of bt1 and bt2 are the same
Is type tp a raw type?
Do tp1
and tp2
denote equivalent types?
Are tps1
and tps2
lists of pairwise equivalent types?
Are tps1
and tps2
lists of equal length such that all elements
of tps1
conform to corresponding elements of tps2
?
Do type arguments targs
conform to formal parameters tparams
?
The least upper bound of a list of types, as determined by <:<
.
The maximum allowable depth of lubs or glbs over types ts
.
like map2, but returns list xs
itself - instead of a copy - if function
f
maps all elements to themselves.
A function implementing tp1
matches tp2
.
The maximum number of recursions allowed in toString
Compute lub (if variance == 1
) or glb (if variance == -1
) of given list
of types tps
.
Compute lub (if variance == 1
) or glb (if variance == -1
) of given list
of types tps
. All types in tps
are typerefs or singletypes
with the same symbol.
Return Some(x)
if the computation succeeds with result x
.
Return None
if the computation fails.
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
true
if the argument is not a reference to the receiver object; false
otherwise.
Does a pattern of type patType
need an outer test when executed against
selector type selType
in context defined by currentOwner
?
A creator for existential types which flattens nested existentials.
Wakes up a single thread that is waiting on the receiver object's monitor.
Wakes up a single thread that is waiting on the receiver object's monitor.
not specified by SLS as a member of AnyRef
Wakes up all threads that are waiting on the receiver object's monitor.
Wakes up all threads that are waiting on the receiver object's monitor.
not specified by SLS as a member of AnyRef
The raw to existential map converts a raw type to an existential type.
The raw to existential map converts a raw type to an existential type. It is necessary because we might have read a raw type of a parameterized Java class from a class file. At the time we read the type the corresponding class file might still not be read, so we do not know what the type parameters of the type are. Therefore the conversion of raw types to existential types might not have taken place in ClassFileparser.sigToType (where it is usually done).
The canonical creator for a refined type with an initially empty scope.
the canonical creator for a refined type with a given scope
Repack existential types, otherwise they sometimes get unpacked in the wrong location (type inference comes up with an unexpected skolem)
True if two lists have the same length.
True if two lists have the same length. Since calling length on linear sequences is O(n), it is an inadvisable way to test length equality.
The canonical creator for single-types
The current skolemization level, needed for the algorithms in isSameType, isSubType that do constraint solving under a prefix.
Solve constraint collected in types tvars
.
Solve constraint collected in types tvars
.
All type variables to be instantiated.
The type parameters corresponding to tvars
The variances of type parameters; need to reverse solution direction for all contravariant variables.
When true
search for max solution else min.
A minimal type list which has a given list of types as its base type sequence
Does type tp
implement symbol sym
with same or
stronger type? Exact only if sym
is a member of some
refinement type, otherwise we might return false negatives.
Make each type var in this type use its original type for comparisons instead of collecting constraints.
Creates a String representation of this object.
Creates a String representation of this object. The default representation is platform dependent. On the java platform it is the concatenation of the class name, "@", and the object's hashcode in hexadecimal.
a String representation of the object.
The maximum depth of type tp
A creator for a type functions, assuming the type parameters tps already have the right owner.
A creator for anonymous type functions, where the symbol for the type function still needs to be created.
A creator for anonymous type functions, where the symbol for the type function still needs to be created.
TODO: type params of anonymous type functions, which currently can only arise from normalising type aliases, are owned by the type alias of which they are the eta-expansion higher-order subtyping expects eta-expansion of type constructors that arise from a class; here, the type params are owned by that class, but is that the right thing to do?
A collector that tests for existential types appearing at given variance in a type
The canonical creator for typerefs todo: see how we can clean this up a bit
A map to convert every occurrence of a type variable to a wildcard type.
A list of the typevars in a type.
A log of type variable with their original constraints.
A log of type variable with their original constraints. Used in order to undo constraints in the case of isSubType/isSameType failure.
Overridden in reflection compiler
A map to convert every occurrence of a wildcard type to a fresh type variable
Execute op
while printing a trace of the operations on types executed.
(types: StringAdd).self
(types: StringFormat).self
A creator for type parameterizations that strips empty type parameter lists.
A creator for type parameterizations that strips empty type parameter lists. Use this factory method to indicate the type has kind * (it's a polymorphic value) until we start tracking explicit kinds equivalent to typeFun (except that the latter requires tparams nonEmpty).
(Since version 2.10.0) use genPolyType(...) instead
(types: ArrowAssoc[Types]).x
(Since version 2.10.0) Use leftOfArrow
instead
(types: Ensuring[Types]).x
(Since version 2.10.0) Use resultOfEnsuring
instead