None collect ({ case n if n > 0 => n + 1; case _ => 0})
Why nhas a method >? There is nothing to allow the compiler to suggest this. So try changing this to:
None collect ({ case n: Int if n > 0 => n + 1; case _ => 0})
And you will get the following error message:
<console>:8: error: pattern type is incompatible with expected type;
found : Int
required: Nothing
None collect ({ case n: Int if n > 0 => n + 1; case _ => 0})
^
, , , Int, , None. , None Option[Nothing].