Primitive and aggregate types don't participate in subtyping and they have
to be explicitly boxed to become compatible with a reference type.
Reference types form a simple lattice with java.lang.Object at the top and
null type at the bottom. Subtyping between traits and classes is based on
linearization of the all transitive parents, similarly to scalac.
Nothing is the common bottom type between reference and value types. It
represents computations that may never complete normally (either loops
forever or throws an exception).
Our subtyping can be described by a following diagram:
Primitive and aggregate types don't participate in subtyping and they have to be explicitly boxed to become compatible with a reference type.
Reference types form a simple lattice with java.lang.Object at the top and null type at the bottom. Subtyping between traits and classes is based on linearization of the all transitive parents, similarly to scalac.
Nothing is the common bottom type between reference and value types. It represents computations that may never complete normally (either loops forever or throws an exception).