Option(null) has a lower bound on Option[Null] , where Null is the bottom type of all reference types. Int is a value type, not a reference type. those. You cannot assign Null to Int . Therefore, you cannot assign Option[Null] Option[Int] .
Use Option.empty[Int] or None instead.
source share