When doing this:
def myfunction(line: String): (Int, Option[DateTime], Option[Int]) = {
// do some stuff
(5, Option(null), Option(null))
}
I get the following:
an expression of type Null is ineligible for implicit conversion
I'm not sure how to fix it.
Option(null)
has a lower bound ofOption[Null]
, whereNull
is the bottom-type of all reference types.Int
is a value type, and not a reference type. i.e. you can't assignnull
to anInt
. So you can't assignOption[Null]
toOption[Int]
.Use
Option.empty[Int]
orNone
instead.