diff --git a/docs/_assets/images/explicit-nulls/explicit-nulls-type-hierarchy.png b/docs/_assets/images/explicit-nulls/explicit-nulls-type-hierarchy.png deleted file mode 100644 index 65179260c246..000000000000 Binary files a/docs/_assets/images/explicit-nulls/explicit-nulls-type-hierarchy.png and /dev/null differ diff --git a/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchable.pdf b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchable.pdf new file mode 100644 index 000000000000..c98841c63b5a Binary files /dev/null and b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchable.pdf differ diff --git a/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchable.png b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchable.png new file mode 100644 index 000000000000..12007b21d06a Binary files /dev/null and b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchable.png differ diff --git a/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.pdf b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.pdf new file mode 100644 index 000000000000..77792133f25f Binary files /dev/null and b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.pdf differ diff --git a/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.png b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.png new file mode 100644 index 000000000000..3e671f615d10 Binary files /dev/null and b/docs/_assets/images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.png differ diff --git a/docs/_docs/reference/experimental/explicit-nulls.md b/docs/_docs/reference/experimental/explicit-nulls.md index ebdb3356d99e..2a9a844b22d3 100644 --- a/docs/_docs/reference/experimental/explicit-nulls.md +++ b/docs/_docs/reference/experimental/explicit-nulls.md @@ -31,12 +31,17 @@ Read on for details. ## New Type Hierarchy -When explicit nulls are enabled, the type hierarchy changes so that `Null` is only a subtype of -`Any`, as opposed to every reference type, which means `null` is no longer a value of `AnyRef` and its subtypes. +Originally, `Null` is a subtype of all reference types. + +!["Original Type Hierarchy"](images/explicit-nulls/scalaHierarchyWithMatchable.png) + +When explicit nulls is enabled, the type hierarchy changes so that `Null` is only +a subtype of `Any` and `Matchable`, as opposed to every reference type, +which means `null` is no longer a value of `AnyRef` and its subtypes. This is the new type hierarchy: -!["Type Hierarchy for Explicit Nulls"](images/explicit-nulls/explicit-nulls-type-hierarchy.png) +!["Type Hierarchy for Explicit Nulls"](images/explicit-nulls/scalaHierarchyWithMatchableAndSafeNull.png) After erasure, `Null` remains a subtype of all reference types (as forced by the JVM).