Apparently Range has a method that checks if it contains a value of type Any. I understand that it is from SeqLike, but causes some problems.
For instance, i was matching hours from joda.DateTime:
DateTime.now match {
case d if 0 to 12 contains d.hourOfDay() => ...
Here d.hourOfDay() returns DateTime.Property, not Int, but code still compiles, because of contains(elem: Any). Is there any way to check for such calls at compile time?
You can pimp
Rangeto add a type-safer contains method:Import the implicit and call
safeContainson any range instance: