Scala: generics, primitive types and nulls

While working on a Scala (2.12.4) project, I made a typo in my code and received an interesting output: [code lang="scala"] scala> new Get[Int]().inner() == null <console>:13: warning: comparing values of types Int and Null using `==' will always yield false new Get[Int]().inner() == null ^ res0: Boolean = true [/code] While it was an absolutely useless construction, it still causes such misleading output as seen above: [code lang="scala"] class Get[T]() { val x: T = inner() def inner(): T = x } new Get[Int]().inner() == null [/code] I would say that this is a minor Scala bug and probably is a side effect of some of
value type + null
bugs and other
bugs,
bugs.