From 728459a5046759a91075f3e03dba21076133feb5 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 16 May 2019 15:42:41 +0300 Subject: [PATCH] Add IR for-in-range test --- .../testData/ir/irText/expressions/for.fir.txt | 17 ++++++++++++++++- compiler/testData/ir/irText/expressions/for.kt | 3 +++ compiler/testData/ir/irText/expressions/for.txt | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/compiler/testData/ir/irText/expressions/for.fir.txt b/compiler/testData/ir/irText/expressions/for.fir.txt index 17054600a2e..e28d9824d09 100644 --- a/compiler/testData/ir/irText/expressions/for.fir.txt +++ b/compiler/testData/ir/irText/expressions/for.fir.txt @@ -56,4 +56,19 @@ FILE fqName: fileName:/for.kt message: GET_VAR 'val i: kotlin.Int [val] declared in .testDestructuring' type=kotlin.Int origin=null CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null message: GET_VAR 'val s: kotlin.String [val] declared in .testDestructuring' type=kotlin.String origin=null - + FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + VAR name: type:kotlin.ranges.IntRange [val] + CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange declared in kotlin.Int' type=kotlin.ranges.IntRange origin=null + $this: CONST Int type=kotlin.Int value=1 + other: CONST Int type=kotlin.Int value=10 + VAR name: type:kotlin.collections.IntIterator [val] + CALL 'public open fun iterator (): kotlin.collections.IntIterator declared in kotlin.ranges.IntProgression' type=kotlin.collections.IntIterator origin=null + $this: GET_VAR 'val : kotlin.ranges.IntRange [val] declared in .testRange' type=kotlin.ranges.IntRange origin=null + WHILE label=null origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.Iterator' type=kotlin.Boolean origin=null + $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null + body: BLOCK type=kotlin.Unit origin=null + VAR name:i type:kotlin.Int [val] + CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=null + $this: GET_VAR 'val : kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null diff --git a/compiler/testData/ir/irText/expressions/for.kt b/compiler/testData/ir/irText/expressions/for.kt index 4c0985ad1e5..3126a8fd2dc 100644 --- a/compiler/testData/ir/irText/expressions/for.kt +++ b/compiler/testData/ir/irText/expressions/for.kt @@ -17,3 +17,6 @@ fun testDestructuring(pp: List>) { } } +fun testRange() { + for (i in 1..10); +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/for.txt b/compiler/testData/ir/irText/expressions/for.txt index c689d2d40a3..d0b38bcb356 100644 --- a/compiler/testData/ir/irText/expressions/for.txt +++ b/compiler/testData/ir/irText/expressions/for.txt @@ -55,3 +55,18 @@ FILE fqName: fileName:/for.kt message: GET_VAR 'val i: kotlin.Int [val] declared in .testDestructuring' type=kotlin.Int origin=null CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null message: GET_VAR 'val s: kotlin.String [val] declared in .testDestructuring' type=kotlin.String origin=null + FUN name:testRange visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + BLOCK type=kotlin.Unit origin=FOR_LOOP + VAR FOR_LOOP_ITERATOR name:tmp0_iterator type:kotlin.collections.IntIterator [val] + CALL 'public open fun iterator (): kotlin.collections.IntIterator declared in kotlin.ranges.IntRange' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR + $this: CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE + $this: CONST Int type=kotlin.Int value=1 + other: CONST Int type=kotlin.Int value=10 + WHILE label=null origin=FOR_LOOP_INNER_WHILE + condition: CALL 'public abstract fun hasNext (): kotlin.Boolean declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT + $this: GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null + body: BLOCK type=kotlin.Unit origin=FOR_LOOP_INNER_WHILE + VAR FOR_LOOP_VARIABLE name:i type:kotlin.Int [val] + CALL 'public final fun next (): kotlin.Int declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT + $this: GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in .testRange' type=kotlin.collections.IntIterator origin=null