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 ==
Is this type a subtype of that type?
Is this type equivalent to that type?
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 annotations on this type.
The annotations on this type.
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
.
This type as seen from prefix pre
and class clazz
.
This type as seen from prefix pre
and class clazz
. This means:
Replace all thistypes of clazz
or one of its subclasses
by pre
and instantiate all parameters by arguments of pre
.
Proceed analogously for thistypes referring to outer classes.
Example: class D[T] { def m: T } class C extends p.D[Int] T.asSeenFrom(ThisType(C), D) (where D is owner of m)
Make sure this type is correct as the info of given owner; clone it if not.
Make sure this type is correct as the info of given owner; clone it if not.
The list of all baseclasses of this type (including its own typeSymbol) in reverse linearization order, starting with the class itself and ending in class Any.
The least type instance of given class which is a supertype of this type.
the class symbol
the index of given class symbol in the BaseTypeSeq of this type, or -1 if no base type with given class symbol exists.
The shortest sorted upwards closed array of types that contains this type as first element.
The shortest sorted upwards closed array of types that contains this type as first element.
A list or array of types ts is upwards closed if
for all t in ts: for all typerefs p.s[args] such that t <: p.s[args] there exists a typeref p'.s[args'] in ts such that t <: p'.s['args] <: p.s[args],
and
for all singleton types p.s such that t <: p.s there exists a singleton type p'.s in ts such that t <: p'.s <: p.s
Sorting is with respect to Symbol.isLess() on type symbols.
The maximum depth (@see typeDepth) of each type in the BaseTypeSeq of this type except the first.
The maximum depth (@see typeDepth) of each type in the BaseTypeSeq of this type except the first.
For a (potentially wrapped) poly or existential type, its bound symbols, the empty list for all other types
For a (potentially wrapped) poly or existential type, its bound symbols, the empty list for all other types
For a TypeBounds type, itself; for a reference denoting an abstract type, its bounds, for all other types, a TypeBounds type all of whose bounds are this type.
For a TypeBounds type, itself; for a reference denoting an abstract type, its bounds, for all other types, a TypeBounds type all of whose bounds are this type.
Create a copy of the receiver object.
If this is a poly- or methodtype, a copy with cloned type / value parameters
owned by owner
.
If this is a poly- or methodtype, a copy with cloned type / value parameters
owned by owner
. Identity for all other types.
Apply pf' to each part of this type on which the function is defined
Apply pf' to each part of this type on which the function is defined
If this is a lazy type, assign a new type to sym
.
If this is a lazy type, assign a new type to sym
.
Does this type contain a reference to this symbol?
Does this type contain a reference to this type
Does this type contain a reference to this type
Expands type aliases.
Expands type aliases.
The defined or declared members with name name
in this type;
an OverloadedSymbol if several exist, NoSymbol if none exist.
The defined or declared members with name name
in this type;
an OverloadedSymbol if several exist, NoSymbol if none exist.
Alternatives of overloaded symbol appear in the order they are declared.
The defined or declared members with name name
in this type;
an OverloadedSymbol if several exist, NoSymbol if none exist.
The defined or declared members with name name
in this type;
an OverloadedSymbol if several exist, NoSymbol if none exist.
Alternatives of overloaded symbol appear in the order they are declared.
The collection of declarations in this type [Eugene++] why not List?
The collection of declarations in this type [Eugene++] why not List?
For a classtype or refined type, its defined or declared members; inherited by subtypes and typerefs.
For a classtype or refined type, its defined or declared members; inherited by subtypes and typerefs. The empty scope for all other types.
Map a constant type or not-null-type to its underlying base type, identity for all other types.
Map a constant type or not-null-type to its underlying base type, identity for all other types.
A list of all deferred symbols of this type (defined or inherited)
A list of all deferred symbols of this type (defined or inherited)
The string representation of this type when the direct object in a sentence.
The string representation of this type when the direct object in a sentence. Normally this is no different from the regular representation, but modules read better as "object Foo" here and "Foo.type" the rest of the time.
A list of placeholder types derived from the type parameters.
A list of placeholder types derived from the type parameters. Used by RefinedType and TypeRef.
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.
The erased type corresponding to this type after all transformations from Scala to Java have been performed.
The erased type corresponding to this type after all transformations from Scala to Java have been performed.
Is there part of this type which satisfies predicate p
?
Returns all parts of this type which satisfy predicate p
Returns all parts of this type which satisfy predicate p
For a curried/nullary method or poly type its non-method result type, the type itself for all other types
For a curried/nullary method or poly type its non-method result type, the type itself for all other types
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.
Returns optionally first type (in a preorder traversal) which satisfies predicate p
,
or None if none exists.
Find member(s) in this type.
Find member(s) in this type. If several members matching criteria are found, they are returned in an OverloadedSymbol
The member's name, where nme.ANYNAME means unspecified
Returned members do not have these flags
Returned members do have these flags
If set, return only members that are types or stable values
For a class with nonEmpty parents, the first parent.
For a class with nonEmpty parents, the first parent. Otherwise some specific fixed top type.
Apply f
to each part of this type
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
Test for, get, or remove an annotation
Test for, get, or remove an annotation
The hashCode method for reference types.
A list of all implicit symbols of this type (defined or inherited)
A list of all implicit symbols of this type (defined or inherited)
Replace formal type parameter symbols with actual type arguments.
Replace formal type parameter symbols with actual type arguments.
Amounts to substitution except for higher-kinded types. (See overridden method in TypeRef) -- @M
Is this type completed (i.
Does this type refer to spliceable types or is a spliceable type?
Does this type refer to spliceable types or is a spliceable type?
Does this depend on an enclosing method parameter?
Does this depend on an enclosing method parameter?
Is this type produced as a repair for an error?
Is this type produced as a repair for an error?
Is this type produced as a repair for an error?
Is this type produced as a repair for an error?
Can this type only be subtyped by bottom types? This is assessed to be the case if the class is final, and all type parameters (if any) are invariant.
Can this type only be subtyped by bottom types? This is assessed to be the case if the class is final, and all type parameters (if any) are invariant.
A test whether a type contains any unification type variables.
A test whether a type contains any unification type variables. Overridden with custom logic except where trivially true.
Is this type higher-kinded, i.
Does this type depend immediately on an enclosing method parameter? I.
Does this type depend immediately on an enclosing method parameter? I.e., is it a singleton type whose termSymbol refers to an argument of the symbol's owner (which is a method)?
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.
Is this type guaranteed not to have null
as a value?
Is this type guaranteed not to have null
as a value?
Is this type an abstract type that needs to be resolved?
Is this type an abstract type that needs to be resolved?
Does this type denote a stable reference (i.
Does this type denote a stable reference (i.e. singleton type)?
Is this type a structural refinement type (it refines members that have not been inherited)
Is this type a structural refinement type (it refines members that have not been inherited)
Types for which asSeenFrom always is the identity, no matter what prefix or owner.
Types for which asSeenFrom always is the identity, no matter what prefix or owner.
Is this type dangerous (i.
Is this type dangerous (i.e. it might contain conflicting type information when empty, so that it can be constructed so that type unsoundness results.) A dangerous type has an underlying type of the form T_1 with T_n { decls }, where one of the T_i (i > 1) is an abstract type.
True for WildcardType or BoundedWildcardType.
True for WildcardType or BoundedWildcardType.
The kind of this type; used for debugging
If this is a symbol loader type, load and assign a new type to sym
.
If this is a symbol loader type, load and assign a new type to sym
.
Same as matches, except that non-method types are always assumed to match.
Same as matches, except that non-method types are always assumed to match.
Apply f
to each part of this type; children get mapped before their parents
Is this type close enough to that type so that members with the two type would override each other? This means:
Is this type close enough to that type so that members with the two type would override each other? This means:
Is this type a subtype of that type in a pattern context? Any type arguments on the right hand side are replaced with fresh existentials, except for Arrays.
Is this type a subtype of that type in a pattern context? Any type arguments on the right hand side are replaced with fresh existentials, except for Arrays.
See bug1434.scala for an example of code which would fail if only a <:< test were applied.
The member with given name, an OverloadedSymbol if several exist, NoSymbol if none exist
The info of sym
, seen as a member of this type.
The info of sym
, seen as a member of this type.
Example:
class D[T] { def m: T } class C extends p.D[Int] ThisType(C).memberType(m) = Int
The type of sym
, seen as a member of this type.
The type of sym
, seen as a member of this type.
A list of all members of this type (defined or inherited) Members appear in linearization order of their owners.
Members excluding and requiring the given flags.
Members excluding and requiring the given flags. Note: unfortunately it doesn't work to exclude DEFERRED this way.
All members with the given flags, excluding bridges.
All members with the given flags, excluding bridges.
Map to a singleton type which is a subtype of this type.
Map to a singleton type which is a subtype of this type. The fallback implemented here gives:
T.narrow = (T {}).this.type
Overridden where we know more about where types come from.
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
true
if the argument is not a reference to the receiver object; false
otherwise.
The non-local member with given name, an OverloadedSymbol if several exist, NoSymbol if none exist
The non-local member with given name, an OverloadedSymbol if several exist, NoSymbol if none exist
The non-private defined or declared members with name name
in this type;
an OverloadedSymbol if several exist, NoSymbol if none exist.
The non-private defined or declared members with name name
in this type;
an OverloadedSymbol if several exist, NoSymbol if none exist.
Alternatives of overloaded symbol appear in the order they are declared.
A list of all non-private members defined or declared in this type.
A list of all non-private members defined or declared in this type.
The non-private member with given name, an OverloadedSymbol if several exist, NoSymbol if none exist.
The non-private member with given name, admitting members with given flags admit
.
The non-private member with given name, admitting members with given flags admit
.
"Admitting" refers to the fact that members with a PRIVATE, BRIDGE, or VBRIDGE
flag are usually excluded from findMember results, but supplying any of those flags
to this method disables that exclusion.
An OverloadedSymbol if several exist, NoSymbol if none exists.
A list of all non-private members of this type (defined or inherited)
A list of all non-private members of this type (defined or inherited),
admitting members with given flags admit
A list of all non-private members of this type (defined or inherited),
admitting members with given flags admit
All non-private members with the given flags, excluding bridges.
All non-private members with the given flags, excluding bridges.
Reduce to beta eta-long normal form.
Reduce to beta eta-long normal form. Expands type aliases and converts higher-kinded TypeRefs to PolyTypes. Functions on types are also implemented as PolyTypes.
Example: (in the below, <List> is the type constructor of List) TypeRef(pre, <List>, List()) is replaced by PolyType(X, TypeRef(pre, <List>, List(X)))
Mixin a NotNull trait unless type already has one .
Mixin a NotNull trait unless type already has one ...if the option is given, since it is causing typing bugs.
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
For a method type, the number of its value parameter sections, 0 for all other types
For a method type, the number of its value parameter sections, 0 for all other types
For a method or poly type, the types of its first value parameter section, the empty list for all other types
For a method or poly type, the types of its first value parameter section, the empty list for all other types
For a method or poly type, its first value parameter section, the empty list for all other types
For a method or poly type, its first value parameter section, the empty list for all other types
For a method or poly type, a list of its value parameter sections, the empty list for all other types
For a method or poly type, a list of its value parameter sections, the empty list for all other types
For a class or intersection type, its parents.
For a typeref or single-type, the prefix of the normalized type (@see normalize).
For a typeref or single-type, the prefix of the normalized type (@see normalize). NoType for all other types.
A chain of all typeref or singletype prefixes of this type, longest first.
A chain of all typeref or singletype prefixes of this type, longest first. (Only used from safeToString.)
The string representation of this type used as a prefix
The string representation of this type used as a prefix
If this is a TypeRef clazz
[T
], return the argument T
otherwise return this type
If this is a TypeRef clazz
[T
], return the argument T
otherwise return this type
Only used for dependent method types.
Only used for dependent method types.
For a (nullary) method or poly type, its direct result type, the type itself for all other types.
For a (nullary) method or poly type, its direct result type, the type itself for all other types.
Method to be implemented in subclasses.
The selfsym of an annotated type, or NoSymbol of anything else
The selfsym of an annotated type, or NoSymbol of anything else
A simple version of skolemizeExistential for situations where owner or unpack location do not matter (typically used in subtype tests)
A simple version of skolemizeExistential for situations where owner or unpack location do not matter (typically used in subtype tests)
If this type is an existential, turn all existentially bound variables to type skolems.
If this type is an existential, turn all existentially bound variables to type skolems.
The owner of the created type skolems
The tree whose type was an existential for which the skolem was created.
The (existential or otherwise) skolems and existentially quantified variables which are free in this type
The (existential or otherwise) skolems and existentially quantified variables which are free in this type
Does this type implement symbol sym
with same or stronger type?
Does this type implement symbol sym
with same or stronger type?
Remove any annotations from this type and from any types embedded in this type.
Remove any annotations from this type and from any types embedded in this type.
Substitute types to
for occurrences of references to
symbols from
in this type.
Substitute types to
for occurrences of references to
symbols from
in this type.
Substitute symbols to
for occurrences of symbols from
in this type.
Substitute symbols to
for occurrences of symbols from
in this type.
!!! NOTE !!!: If you need to do a substThis and a substSym, the substThis has to come first, as otherwise symbols will immediately get rebound in typeRef to the old symbol.
Substitute all occurrences of ThisType(from)
in this type by to
.
Substitute all occurrences of ThisType(from)
in this type by to
.
!!! NOTE !!!: If you need to do a substThis and a substSym, the substThis has to come first, as otherwise symbols will immediately get rebound in typeRef to the old symbol.
Performs both substThis and substSym, in that order.
Performs both substThis and substSym, in that order.
[JZ] Reverted SubstThisAndSymMap
from 334872, which was not the same as
substThis(from, to).substSym(symsFrom, symsTo)
.
SubstThisAndSymMap
performs a breadth-first map over this type, which meant that
symbol substitution occured before ThisType
substitution. Consequently, in substitution
of a SingleType(ThisType(
from), sym), symbols were rebound to
from rather than
to.
Substitute symbols in to
for corresponding occurrences of references to
symbols from
in this type.
Substitute symbols in to
for corresponding occurrences of references to
symbols from
in this type.
Substitute types in to
for corresponding occurrences of references to
symbols from
in this type.
Substitute types in to
for corresponding occurrences of references to
symbols from
in this type.
The term symbol associated with the type Note that the symbol of the normalized type is returned (@see normalize)
The term symbol associated with the type Note that the symbol of the normalized type is returned (@see normalize)
The term symbol directly associated with the type.
The term symbol directly associated with the type.
Symbols of any @throws annotations on this symbol.
Symbols of any @throws annotations on this symbol.
The string representation of this type, with singletypes explained.
The string representation of this type, with singletypes explained.
Convert toString avoiding infinite recursions by cutting off
after maxTostringRecursions
recursion levels.
For a typeref, its arguments.
For a typeref, its arguments. The empty list for all other types
If this is a parameterized types, the type arguments.
If this is a parameterized types, the type arguments. Otherwise the empty list
This type, without its type arguments @M
The type of this
of a class type or reference type.
The type of this
of a class type or reference type.
For a (potentially wrapped) poly type, its type parameters, the empty list for all other types
The type symbol associated with the type Note that the symbol of the normalized type is returned (@see normalize) A type's typeSymbol should if possible not be inspected directly, due to the likelihood that what is true for tp.
The type symbol associated with the type Note that the symbol of the normalized type is returned (@see normalize) A type's typeSymbol should if possible not be inspected directly, due to the likelihood that what is true for tp.typeSymbol is not true for tp.sym, due to normalization.
The type symbol directly associated with the type.
The type symbol directly associated with the type. In other words, no normalization is performed: if this is an alias type, the symbol returned is that of the alias, not the underlying type.
The base type underlying a type proxy, identity on all other types
Is this type a weak subtype of that type? True also for numeric types, i.
Is this type a weak subtype of that type? True also for numeric types, i.e. Int weak_<:< Long.
Widen from singleton type to its underlying non-singleton
base type by applying one or more underlying
dereferences,
identity for all other types.
Set the self symbol of an annotated type, or do nothing otherwise.
Set the self symbol of an annotated type, or do nothing otherwise.
(Since version 2.10.0) Use leftOfArrow instead
(Since version 2.10.0) Use resultOfEnsuring instead