Convert to range check: don't report it if recursive call will be created

#KT-39182 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-06-10 18:01:28 +09:00
committed by Yan Zhulanow
parent 03e725d5da
commit 731848849e
3 changed files with 52 additions and 10 deletions
@@ -0,0 +1,21 @@
// PROBLEM: none
// WITH_RUNTIME
class TimeIndex(val intValue: Int) : Comparable<TimeIndex> {
override fun compareTo(other: TimeIndex): Int {
TODO()
}
operator fun rangeTo(other: TimeIndex): TimeIndexRange {
return TimeIndexRange(this, other)
}
}
data class TimeIndexRange(val start: TimeIndex, val end: TimeIndex) : Iterable<TimeIndex> {
override fun iterator(): Iterator<TimeIndex> {
TODO()
}
operator fun contains(index: TimeIndex): Boolean {
return <caret>start <= index && index <= end
}
}