The Types Scaladoc page warns:
Type Equality can be checked with =:=. It's important to note that == should not be used to compare types for equality-- == can't check for type equality in the presence of type aliases, while =:= can.
There is no similar warning for Symbols, but looking at the implementation, it doesn't appear to override equals
. Is there a way to compare symbols for equality (i.e. whether they represent the same Scala type/val/method/etc.)?
For TypeSymbol
s I can obviously use .toType
and =:=
, so the question is primarily about TermSymbol
s.
Aucun commentaire:
Enregistrer un commentaire