In line “if (max == null || less(max, it))” you pass variable max (type: T?) to function less that receives two not nullable arguments, so you should use .sure() function: “if (max == null || less(max.sure(), it))” . It is safe, because “less(max.sure(), it)” will be computed only if max != null.
Thanks! Since your reply, my plugin automatically updated, and now the IDE is much more precise, before runtime, about what the problem is. Screenshot attached.
And if I use “max.sure()” as you suggest, all the red in the IDE goes away.
Maybe I expect too much, but if max is null, the code after the OR is not going to execute. Which means in the post-OR part the IDE/compiler could relieve me of typing max.sure(). No? funargs1.png