Ah, as you can see with my second response where I...
# codereview
d
Ah, as you can see with my second response where I correct myself, based on what the code seems to be doing the answer is “Null is less than 7 if this is a lower bounds check, or greater than 7 if it’s an upper bounds check.” If that’s correct, then with two different methods it should work, like
fun containsCompletely(other: OpenRange<NumberType>): Boolean = this.startInclusive lessOrEqual other.startInclusive && this.endInclusive greaterOrEqual other.endInclusive
where
lessEqual
is something like
Copy code
infix fun NumberType?.lessOrEqual(other: NumberType?) { 
  if(this == null && other == null) {
    return true
  } else if(this == null) {
    return true //could collapse this with the above statement
  } else if(other == null) {
    return false
  } else {
    return this <= other
  } 
}