Skip to content

Commit

Permalink
Update doc page
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Dec 14, 2020
1 parent 2e77d34 commit 0a28853
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/docs/reference/other-new-features/matchable.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,25 @@ extended by both `AnyVal` and `AnyRef`. Since `Matchable` is a supertype of ever
- Type parameters and abstract types that are only bounded by some
universal trait: Again, `Matchable` should be added as a bound.

Here is the hierarchy of toplevel classes and traits with their defined methods:
```scala
abstract class Any:
def getClass
def isInstanceOf
def asInstanceOf
def ==
def !=
def ##
def equals
def hashCode
def toString

trait Matchable extends Any

class AnyVal extends Any, Matchable
class Object extends Any, Matchable
```

`Matchable` is currently a marker trait without any methods. Over time
we might migrate methods `getClass` and `isInstanceOf` to it, since these are closely related to pattern-matching.

0 comments on commit 0a28853

Please sign in to comment.