Check out the Scala language specification , namely: 6.3. Null Value Section:
The null value is of type scala.Null and, therefore, is compatible with all references of the type. It denotes a reference value that refers to the special null object. This object implements methods in the scala.AnyRef class as follows:
• eq(x) and ==(x) returns true if x also a null object.
• ne(x) and !=(x) returns true if x not a “null” object either.
This means that semantically, when you compare something with a null literal or null literal with something that you are actually referring to a method of the special class scala.Null , Treat the null literal as an abbreviation for this class.
Of course, at the implementation level it is optimized and uses regular null .
Tomasz Nurkiewicz
source share