Introduce a workaround in interpreter tests to make them pass

There is a problem with ranges and iterators. To work properly
they must be resolved firstly, before operator rangeTo.
This commit is contained in:
Ivan Kylchik
2021-08-04 14:16:18 +03:00
committed by TeamCityServer
parent 44e1b61e6c
commit 4f15bd4817
6 changed files with 26 additions and 2 deletions
+4 -1
View File
@@ -1,4 +1,7 @@
// IGNORE_BACKEND: JVM_IR
// this hack is used to ensure that iterator will be resolved first
@CompileTimeCalculation internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator()
@CompileTimeCalculation public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRange<Int>
@CompileTimeCalculation
fun loop(toInc: Int, start: Int, end: Int): Int {
var result = toInc
@@ -1,3 +1,7 @@
// this hack is used to ensure that iterator will be resolved first
@CompileTimeCalculation internal class CharProgressionIterator(first: Char, last: Char, val step: Int) : CharIterator()
@CompileTimeCalculation public class CharRange(start: Char, endInclusive: Char) : CharProgression(start, endInclusive, 1), ClosedRange<Char>
fun compareTo(first: Char, second: Char) = first.compareTo(second)
fun plus(first: Char, second: Int) = first.plus(second)
@@ -1,3 +1,9 @@
// this hack is used to ensure that iterator will be resolved first
@CompileTimeCalculation internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator()
@CompileTimeCalculation public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRange<Int>
@CompileTimeCalculation internal class LongProgressionIterator(first: Long, last: Long, val step: Long) : LongIterator()
@CompileTimeCalculation public class LongRange(start: Long, endInclusive: Long) : LongProgression(start, endInclusive, 1), ClosedRange<Long>
@CompileTimeCalculation fun compareTo(value: Int, other: Byte) = value.compareTo(other)
@CompileTimeCalculation fun compareTo(value: Int, other: Short) = value.compareTo(other)
@CompileTimeCalculation fun compareTo(value: Int, other: Int) = value.compareTo(other)
@@ -1,3 +1,7 @@
// this hack is used to ensure that iterator will be resolved first
@CompileTimeCalculation internal class LongProgressionIterator(first: Long, last: Long, val step: Long) : LongIterator()
@CompileTimeCalculation public class LongRange(start: Long, endInclusive: Long) : LongProgression(start, endInclusive, 1), ClosedRange<Long>
@CompileTimeCalculation fun compareTo(value: Long, other: Byte) = value.compareTo(other)
@CompileTimeCalculation fun compareTo(value: Long, other: Short) = value.compareTo(other)
@CompileTimeCalculation fun compareTo(value: Long, other: Int) = value.compareTo(other)
+4
View File
@@ -1,3 +1,7 @@
// this hack is used to ensure that iterator will be resolved first
@CompileTimeCalculation internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator()
@CompileTimeCalculation public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRange<Int>
const val range = (1..10).<!EVALUATED: `1`!>first<!>
@CompileTimeCalculation
+4 -1
View File
@@ -1,4 +1,7 @@
// IGNORE_BACKEND: JVM_IR
// this hack is used to ensure that iterator will be resolved first
@CompileTimeCalculation internal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator()
@CompileTimeCalculation public class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRange<Int>
@CompileTimeCalculation
fun varargSum(quantityToSum: Int, vararg num: Int): Int {
var sum = 0