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 ==
The expression x == that
is equivalent to if (x eq null) that eq null else x.equals(that)
.
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.
[Martin] Can someone comment this please? I have no idea what it's for and the code is not exactly readable.
Retract arguments that were inferred to Nothing because inference failed.
Retract arguments that were inferred to Nothing because inference failed. Correct types for repeated params.
We detect Nothing-due-to-failure by only retracting a parameter if either:
restpe
restpe == WildcardType
Retracted parameters are mapped to None. TODO:
Rewrite for repeated param types: Map T* entries to Seq[T].
map from tparams to inferred arg, if inference was successful, tparams that map to None are considered left undetermined
type parameters that are inferred as scala.Nothing
and that are not covariant in restpe
are taken to be undetermined
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.
ClassCastException
if the receiver object is not an instance of the erasure of type T0
.
Check that sym
is defined and accessible as a member of
tree site
with type pre
in current context.
error if arguments not within bounds.
TODO: much better error positions.
TODO: much better error positions. Kind of stuck right now because they just pass us the one tree. TODO: Eliminate inPattern, canRemedy, which have no place here.
Create a copy of the receiver object.
Create a copy of the receiver object.
The default implementation of the clone
method is platform dependent.
a copy of the receiver object.
not specified by SLS as a member of AnyRef
True if the given parameter list can accept a tupled argument list, and the argument list can be tupled (based on its length.)
Tests whether the argument (that
) is a reference to the receiver object (this
).
Tests whether the argument (that
) 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.
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.
not specified by SLS as a member of AnyRef
Collects type parameters referred to in a type.
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 hashCode method for reference types.
Substitute free type variables undetparams
of polymorphic argument
expression tree
, given two prototypes strictPt
, and lenientPt
.
Substitute free type variables undetparams
of polymorphic argument
expression tree
, given two prototypes strictPt
, and lenientPt
.
strictPt
is the first attempt prototype where type parameters
are left unchanged. lenientPt
is the fall-back prototype where type
parameters are replaced by WildcardType
s. We try to instantiate
first to strictPt
and then, if this fails, to lenientPt
. If both
attempts fail, an error is produced.
Substitute free type variables undetparams
of type constructor
tree
in pattern, given prototype pt
.
Substitute free type variables undetparams
of type constructor
tree
in pattern, given prototype pt
.
the constructor that needs to be instantiated
the undetermined type parameters
the expected result type of the instance
Assign tree
the symbol and type of the alternative which
matches prototype pt
, if it exists.
Assign tree
the symbol and type of the alternative which
matches prototype pt
, if it exists.
If several alternatives match pt
, take parameterless one.
If no alternative matches pt
, take the parameterless one anyway.
Infer type arguments targs
for tparams
of polymorphic expression in tree
, given prototype pt
.
Infer type arguments targs
for tparams
of polymorphic expression in tree
, given prototype pt
.
Substitute tparams
to targs
in tree
, after adjustment by adjustTypeArgs
, returning the type parameters that were not determined
If passed, infers against specified type treeTp
instead of tree.tp
.
Assign tree
the type of an alternative which is applicable
to argtpes
, and whose result type is compatible with pt
.
Assign tree
the type of an alternative which is applicable
to argtpes
, and whose result type is compatible with pt
.
If several applicable alternatives exist, drop the alternatives which use
default arguments, then select the most specialized one.
If no applicable alternative exists, and pt != WildcardType, try again
with pt = WildcardType.
Otherwise, if there is no best alternative, error.
contains the argument types. If an argument is named, as
"a = 3", the corresponding type is NamedType("a", Int)
. If the name
of some NamedType does not exist in an alternative's parameter names,
the type is replaces by Unit
, i.e. the argument is treated as an
assignment expression.
Substitute free type variables undetparams
of application
fn(args)
, given prototype pt
.
Substitute free type variables undetparams
of application
fn(args)
, given prototype pt
.
fn: the function that needs to be instantiated.
the parameters that need to be determined
the actual arguments supplied in the call.
the expected type of the function application
The type parameters that remain uninstantiated, and that thus have not been substituted.
Assign tree
the type of all polymorphic alternatives
which have the same number of type parameters as does argtypes
with all argtypes are within the corresponding type parameter bounds.
Assign tree
the type of all polymorphic alternatives
which have the same number of type parameters as does argtypes
with all argtypes are within the corresponding type parameter bounds.
If no such polymorphic alternative exist, error.
Type intersection of simple type tp1 with general type tp2.
Type intersection of simple type tp1 with general type tp2. The result eliminates some redundancies.
Is type ftpe1
strictly more specific than type ftpe2
when both are alternatives in an overloaded function?
Is type ftpe1
strictly more specific than type ftpe2
when both are alternatives in an overloaded function?
SLS (sec:overloading-resolution)
is symbol sym1
defined in a proper subclass of symbol sym2
?
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 sym1 (or its companion class in case it is a module) a subclass of sym2 (or its companion class in case it is a module)?
Replace any (possibly bounded) wildcard types in type tp
by existentially bound variables.
Return inferred type arguments, given type parameters, formal parameters, argument types, result type and expected result type.
Return inferred type arguments, given type parameters, formal parameters,
argument types, result type and expected result type.
If this is not possible, throw a NoInstance
exception.
Undetermined type arguments are represented by definitions.NothingTpe
.
No check that inferred parameters conform to their bounds is made here.
the type parameters of the method
the value parameter types of the method
the result type of the method
the argument types of the application
the expected return type of the application
@see adjustTypeArgs
Equivalent to !(this eq that)
.
Equivalent to !(this eq that)
.
true
if the argument is not a reference to the receiver object; false
otherwise.
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
Return inferred proto-type arguments of function, given
its type and value parameters and result type, and a
prototype pt
for the function result.
Return inferred proto-type arguments of function, given
its type and value parameters and result type, and a
prototype pt
for the function result.
Type arguments need to be either determined precisely by
the prototype, or they are maximized, if they occur only covariantly
in the value parameter list.
If instantiation of a type parameter fails,
take WildcardType for the proto-type argument.
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.
If the argument list needs to be tupled for the parameter list, a list containing the type of the tuple.
If the argument list needs to be tupled for the parameter list, a list containing the type of the tuple. Otherwise, the original argument list.
The context-dependent inferencer part