Basic class members generation.
Split testData into 'classes' and 'expressions'.
This commit is contained in:
committed by
Dmitry Petrov
parent
703d3405ed
commit
0b647ac358
@@ -0,0 +1,5 @@
|
||||
val p = 0
|
||||
fun foo() = 1
|
||||
|
||||
fun test(a: IntArray) =
|
||||
a[0] + a[p] + a[foo()]
|
||||
@@ -0,0 +1,22 @@
|
||||
FILE /arrayAccess.kt
|
||||
PROPERTY public val p: kotlin.Int = 0 getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
FUN public fun foo(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun test(/*0*/ a: kotlin.IntArray): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: CALL .get type=kotlin.Int operator=GET_ARRAY_ELEMENT
|
||||
$this: GET_VAR a type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
other: CALL .get type=kotlin.Int operator=GET_ARRAY_ELEMENT
|
||||
$this: GET_VAR a type=kotlin.IntArray operator=null
|
||||
index: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||
other: CALL .get type=kotlin.Int operator=GET_ARRAY_ELEMENT
|
||||
$this: GET_VAR a type=kotlin.IntArray operator=null
|
||||
index: CALL .foo type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,10 @@
|
||||
fun test() {
|
||||
val x = intArrayOf(1, 2, 3)
|
||||
x[1] = 0
|
||||
}
|
||||
|
||||
fun foo() = 1
|
||||
|
||||
fun test2() {
|
||||
intArrayOf(1, 2, 3)[foo()] = 1
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
FILE /arrayAssignment.kt
|
||||
FUN public fun test(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val x: kotlin.IntArray
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
elements: VARARG type=IntArray varargElementType=Int
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
CONST Int type=kotlin.Int value='3'
|
||||
CALL .set type=kotlin.Unit operator=EQ
|
||||
$this: GET_VAR x type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='1'
|
||||
value: CONST Int type=kotlin.Int value='0'
|
||||
FUN public fun foo(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun test2(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL .set type=kotlin.Unit operator=EQ
|
||||
$this: CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
elements: VARARG type=IntArray varargElementType=Int
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
CONST Int type=kotlin.Int value='3'
|
||||
index: CALL .foo type=kotlin.Int operator=null
|
||||
value: CONST Int type=kotlin.Int value='1'
|
||||
@@ -0,0 +1,17 @@
|
||||
fun foo(): IntArray = intArrayOf(1, 2, 3)
|
||||
fun bar() = 42
|
||||
|
||||
class C(val x: IntArray)
|
||||
|
||||
fun testVariable() {
|
||||
var x = foo()
|
||||
x[0] += 1
|
||||
}
|
||||
|
||||
fun testCall() {
|
||||
foo()[bar()] *= 2
|
||||
}
|
||||
|
||||
fun testMember(c: C) {
|
||||
c.x[0]++
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
FILE /arrayAugmentedAssignment1.kt
|
||||
FUN public fun foo(): kotlin.IntArray
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
elements: VARARG type=IntArray varargElementType=Int
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
CONST Int type=kotlin.Int value='3'
|
||||
FUN public fun bar(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
CLASS CLASS C
|
||||
PROPERTY public final val x: kotlin.IntArray getter=null setter=null
|
||||
FUN public fun testVariable(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR var x: kotlin.IntArray
|
||||
CALL .foo type=kotlin.IntArray operator=null
|
||||
BLOCK type=kotlin.Unit operator=PLUSEQ
|
||||
CALL .set type=kotlin.Unit operator=PLUSEQ
|
||||
$this: GET_VAR x type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
||||
$this: GET_VAR x type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
other: CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun testCall(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=MULTEQ
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
CALL .foo type=kotlin.IntArray operator=null
|
||||
VAR val tmp1_index0: kotlin.Int
|
||||
CALL .bar type=kotlin.Int operator=null
|
||||
CALL .set type=kotlin.Unit operator=MULTEQ
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: GET_VAR tmp1_index0 type=kotlin.Int operator=null
|
||||
value: CALL .times type=kotlin.Int operator=MULTEQ
|
||||
$this: CALL .get type=kotlin.Int operator=MULTEQ
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: GET_VAR tmp1_index0 type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='2'
|
||||
FUN public fun testMember(/*0*/ c: C): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
CALL .<get-x> type=kotlin.IntArray operator=GET_PROPERTY
|
||||
$this: GET_VAR c type=C operator=null
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .get type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,11 @@
|
||||
interface IA {
|
||||
operator fun get(index: String): Int
|
||||
}
|
||||
|
||||
interface IB {
|
||||
operator fun IA.set(index: String, value: Int)
|
||||
}
|
||||
|
||||
fun IB.test(a: IA) {
|
||||
a[""] += 42
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
FILE /arrayAugmentedAssignment2.kt
|
||||
CLASS INTERFACE IA
|
||||
FUN public abstract operator fun get(/*0*/ index: kotlin.String): kotlin.Int
|
||||
CLASS INTERFACE IB
|
||||
FUN public abstract operator fun IA.set(/*0*/ index: kotlin.String, /*1*/ value: kotlin.Int): kotlin.Unit
|
||||
FUN public fun IB.test(/*0*/ a: IA): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=PLUSEQ
|
||||
CALL .set type=kotlin.Unit operator=PLUSEQ
|
||||
$this: $RECEIVER of: test type=IB
|
||||
$receiver: GET_VAR a type=IA operator=null
|
||||
index: CONST String type=kotlin.String value=''
|
||||
value: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||
$this: CALL .get type=kotlin.Int operator=PLUSEQ
|
||||
$this: GET_VAR a type=IA operator=null
|
||||
index: CONST String type=kotlin.String value=''
|
||||
other: CONST Int type=kotlin.Int value='42'
|
||||
@@ -0,0 +1,11 @@
|
||||
class Ref(var x: Int)
|
||||
|
||||
fun test1() {
|
||||
var x = 0
|
||||
x = 1
|
||||
x = x + 1
|
||||
}
|
||||
|
||||
fun test2(r: Ref) {
|
||||
r.x = 0
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
FILE /assignments.kt
|
||||
CLASS CLASS Ref
|
||||
PROPERTY public final var x: kotlin.Int getter=null setter=null
|
||||
FUN public fun test1(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR var x: kotlin.Int
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
SET_VAR x type=kotlin.Unit operator=EQ
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
SET_VAR x type=kotlin.Unit operator=EQ
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun test2(/*0*/ r: Ref): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL .<set-x> type=kotlin.Unit operator=EQ
|
||||
$this: GET_VAR r type=Ref operator=null
|
||||
<set-?>: CONST Int type=kotlin.Int value='0'
|
||||
@@ -0,0 +1,18 @@
|
||||
var p = 0
|
||||
|
||||
fun testVariable() {
|
||||
var x = 0
|
||||
x += 1
|
||||
x -= 2
|
||||
x *= 3
|
||||
x /= 4
|
||||
x %= 5
|
||||
}
|
||||
|
||||
fun testProperty() {
|
||||
p += 1
|
||||
p -= 2
|
||||
p *= 3
|
||||
p /= 4
|
||||
p %= 5
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
FILE /augmentedAssignment1.kt
|
||||
PROPERTY public var p: kotlin.Int getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
FUN public fun testVariable(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR var x: kotlin.Int
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
SET_VAR x type=kotlin.Unit operator=PLUSEQ
|
||||
CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||
$this: GET_VAR x type=kotlin.Int operator=PLUSEQ
|
||||
other: CONST Int type=kotlin.Int value='1'
|
||||
SET_VAR x type=kotlin.Unit operator=MINUSEQ
|
||||
CALL .minus type=kotlin.Int operator=MINUSEQ
|
||||
$this: GET_VAR x type=kotlin.Int operator=MINUSEQ
|
||||
other: CONST Int type=kotlin.Int value='2'
|
||||
SET_VAR x type=kotlin.Unit operator=MULTEQ
|
||||
CALL .times type=kotlin.Int operator=MULTEQ
|
||||
$this: GET_VAR x type=kotlin.Int operator=MULTEQ
|
||||
other: CONST Int type=kotlin.Int value='3'
|
||||
SET_VAR x type=kotlin.Unit operator=DIVEQ
|
||||
CALL .div type=kotlin.Int operator=DIVEQ
|
||||
$this: GET_VAR x type=kotlin.Int operator=DIVEQ
|
||||
other: CONST Int type=kotlin.Int value='4'
|
||||
SET_VAR x type=kotlin.Unit operator=PERCEQ
|
||||
CALL .mod type=kotlin.Int operator=PERCEQ
|
||||
$this: GET_VAR x type=kotlin.Int operator=PERCEQ
|
||||
other: CONST Int type=kotlin.Int value='5'
|
||||
FUN public fun testProperty(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL .<set-p> type=kotlin.Unit operator=PLUSEQ
|
||||
<set-?>: CALL .plus type=kotlin.Int operator=PLUSEQ
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=PLUSEQ
|
||||
other: CONST Int type=kotlin.Int value='1'
|
||||
CALL .<set-p> type=kotlin.Unit operator=MINUSEQ
|
||||
<set-?>: CALL .minus type=kotlin.Int operator=MINUSEQ
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=MINUSEQ
|
||||
other: CONST Int type=kotlin.Int value='2'
|
||||
CALL .<set-p> type=kotlin.Unit operator=MULTEQ
|
||||
<set-?>: CALL .times type=kotlin.Int operator=MULTEQ
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=MULTEQ
|
||||
other: CONST Int type=kotlin.Int value='3'
|
||||
CALL .<set-p> type=kotlin.Unit operator=DIVEQ
|
||||
<set-?>: CALL .div type=kotlin.Int operator=DIVEQ
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=DIVEQ
|
||||
other: CONST Int type=kotlin.Int value='4'
|
||||
CALL .<set-p> type=kotlin.Unit operator=PERCEQ
|
||||
<set-?>: CALL .mod type=kotlin.Int operator=PERCEQ
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=PERCEQ
|
||||
other: CONST Int type=kotlin.Int value='5'
|
||||
@@ -0,0 +1,26 @@
|
||||
class A
|
||||
|
||||
operator fun A.plusAssign(s: String) {}
|
||||
operator fun A.minusAssign(s: String) {}
|
||||
operator fun A.timesAssign(s: String) {}
|
||||
operator fun A.divAssign(s: String) {}
|
||||
operator fun A.modAssign(s: String) {}
|
||||
|
||||
val p = A()
|
||||
|
||||
fun testVariable() {
|
||||
val a = A()
|
||||
a += "+="
|
||||
a -= "-="
|
||||
a *= "*="
|
||||
a /= "/="
|
||||
a %= "*="
|
||||
}
|
||||
|
||||
fun testProperty() {
|
||||
p += "+="
|
||||
p -= "-="
|
||||
p *= "*="
|
||||
p /= "/="
|
||||
p %= "%="
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
FILE /augmentedAssignment2.kt
|
||||
CLASS CLASS A
|
||||
FUN public operator fun A.plusAssign(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public operator fun A.minusAssign(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public operator fun A.timesAssign(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public operator fun A.divAssign(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public operator fun A.modAssign(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
PROPERTY public val p: A getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .<init> type=A operator=null
|
||||
FUN public fun testVariable(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val a: A
|
||||
CALL .<init> type=A operator=null
|
||||
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
|
||||
$receiver: GET_VAR a type=A operator=PLUSEQ
|
||||
s: CONST String type=kotlin.String value='+='
|
||||
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
|
||||
$receiver: GET_VAR a type=A operator=MINUSEQ
|
||||
s: CONST String type=kotlin.String value='-='
|
||||
CALL .timesAssign type=kotlin.Unit operator=MULTEQ
|
||||
$receiver: GET_VAR a type=A operator=MULTEQ
|
||||
s: CONST String type=kotlin.String value='*='
|
||||
CALL .divAssign type=kotlin.Unit operator=DIVEQ
|
||||
$receiver: GET_VAR a type=A operator=DIVEQ
|
||||
s: CONST String type=kotlin.String value='/='
|
||||
CALL .modAssign type=kotlin.Unit operator=PERCEQ
|
||||
$receiver: GET_VAR a type=A operator=PERCEQ
|
||||
s: CONST String type=kotlin.String value='*='
|
||||
FUN public fun testProperty(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL .plusAssign type=kotlin.Unit operator=PLUSEQ
|
||||
$receiver: CALL .<get-p> type=A operator=PLUSEQ
|
||||
s: CONST String type=kotlin.String value='+='
|
||||
CALL .minusAssign type=kotlin.Unit operator=MINUSEQ
|
||||
$receiver: CALL .<get-p> type=A operator=MINUSEQ
|
||||
s: CONST String type=kotlin.String value='-='
|
||||
CALL .timesAssign type=kotlin.Unit operator=MULTEQ
|
||||
$receiver: CALL .<get-p> type=A operator=MULTEQ
|
||||
s: CONST String type=kotlin.String value='*='
|
||||
CALL .divAssign type=kotlin.Unit operator=DIVEQ
|
||||
$receiver: CALL .<get-p> type=A operator=DIVEQ
|
||||
s: CONST String type=kotlin.String value='/='
|
||||
CALL .modAssign type=kotlin.Unit operator=PERCEQ
|
||||
$receiver: CALL .<get-p> type=A operator=PERCEQ
|
||||
s: CONST String type=kotlin.String value='%='
|
||||
@@ -0,0 +1,5 @@
|
||||
fun test1(a: Boolean, b: Boolean) = a && b
|
||||
fun test2(a: Boolean, b: Boolean) = a || b
|
||||
|
||||
fun test1x(a: Boolean, b: Boolean) = a and b
|
||||
fun test2x(a: Boolean, b: Boolean) = a or b
|
||||
@@ -0,0 +1,27 @@
|
||||
FILE /booleanOperators.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Boolean operator=ANDAND
|
||||
if: GET_VAR a type=kotlin.Boolean operator=null
|
||||
then: GET_VAR b type=kotlin.Boolean operator=null
|
||||
else: CONST Boolean type=kotlin.Boolean value='false'
|
||||
FUN public fun test2(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Boolean operator=OROR
|
||||
if: GET_VAR a type=kotlin.Boolean operator=null
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: GET_VAR b type=kotlin.Boolean operator=null
|
||||
FUN public fun test1x(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .and type=kotlin.Boolean operator=null
|
||||
$this: GET_VAR a type=kotlin.Boolean operator=null
|
||||
other: GET_VAR b type=kotlin.Boolean operator=null
|
||||
FUN public fun test2x(/*0*/ a: kotlin.Boolean, /*1*/ b: kotlin.Boolean): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .or type=kotlin.Boolean operator=null
|
||||
$this: GET_VAR a type=kotlin.Boolean operator=null
|
||||
other: GET_VAR b type=kotlin.Boolean operator=null
|
||||
@@ -0,0 +1 @@
|
||||
fun box(): String = "OK"
|
||||
@@ -0,0 +1,5 @@
|
||||
FILE /boxOk.kt
|
||||
FUN public fun box(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value='OK'
|
||||
@@ -0,0 +1,39 @@
|
||||
fun test1() {
|
||||
while (true) { break }
|
||||
do { break } while (true)
|
||||
while (true) { continue }
|
||||
do { continue } while (true)
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
OUTER@while(true) {
|
||||
INNER@while(true) {
|
||||
break@INNER
|
||||
break@OUTER
|
||||
}
|
||||
break@OUTER
|
||||
}
|
||||
OUTER@while(true) {
|
||||
INNER@while(true) {
|
||||
continue@INNER
|
||||
continue@OUTER
|
||||
}
|
||||
continue@OUTER
|
||||
}
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
L@while(true) {
|
||||
L@while(true) {
|
||||
break@L
|
||||
}
|
||||
break@L
|
||||
}
|
||||
L@while(true) {
|
||||
L@while(true) {
|
||||
continue@L
|
||||
}
|
||||
continue@L
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
FILE /breakContinue.kt
|
||||
FUN public fun test1(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHILE label=null operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
BREAK label=null depth=0
|
||||
DO_WHILE label=null operator=DO_WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit operator=null
|
||||
BREAK label=null depth=0
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
WHILE label=null operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
CONTINUE label=null depth=0
|
||||
DO_WHILE label=null operator=DO_WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit operator=null
|
||||
CONTINUE label=null depth=0
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
FUN public fun test2(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHILE label=OUTER operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
WHILE label=INNER operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
BREAK label=INNER depth=0
|
||||
BREAK label=OUTER depth=1
|
||||
BREAK label=OUTER depth=0
|
||||
WHILE label=OUTER operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
WHILE label=INNER operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
CONTINUE label=INNER depth=0
|
||||
CONTINUE label=OUTER depth=1
|
||||
CONTINUE label=OUTER depth=0
|
||||
FUN public fun test3(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHILE label=L operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
WHILE label=L operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
BREAK label=L depth=0
|
||||
BREAK label=L depth=0
|
||||
WHILE label=L operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
WHILE label=L operator=WHILE_LOOP
|
||||
condition: CONST Boolean type=kotlin.Boolean value='true'
|
||||
body: BLOCK type=kotlin.Nothing operator=null
|
||||
CONTINUE label=L depth=0
|
||||
CONTINUE label=L depth=0
|
||||
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int, b: Int) {}
|
||||
|
||||
fun noReorder1() = 1
|
||||
fun noReorder2() = 2
|
||||
|
||||
fun reordered1() = 1
|
||||
fun reordered2() = 2
|
||||
|
||||
fun test() {
|
||||
foo(a = noReorder1(), b = noReorder2())
|
||||
foo(b = reordered1(), a = reordered2())
|
||||
foo(b = 1, a = reordered2())
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
FILE /callWithReorderedArguments.kt
|
||||
FUN public fun foo(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public fun noReorder1(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun noReorder2(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
FUN public fun reordered1(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun reordered2(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
FUN public fun test(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL .foo type=kotlin.Unit operator=null
|
||||
a: CALL .noReorder1 type=kotlin.Int operator=null
|
||||
b: CALL .noReorder2 type=kotlin.Int operator=null
|
||||
BLOCK type=kotlin.Unit operator=ARGUMENTS_REORDERING_FOR_CALL
|
||||
VAR val tmp0_b: kotlin.Int
|
||||
CALL .reordered1 type=kotlin.Int operator=null
|
||||
VAR val tmp1_a: kotlin.Int
|
||||
CALL .reordered2 type=kotlin.Int operator=null
|
||||
CALL .foo type=kotlin.Unit operator=null
|
||||
a: GET_VAR tmp1_a type=kotlin.Int operator=null
|
||||
b: GET_VAR tmp0_b type=kotlin.Int operator=null
|
||||
BLOCK type=kotlin.Unit operator=ARGUMENTS_REORDERING_FOR_CALL
|
||||
VAR val tmp2_a: kotlin.Int
|
||||
CALL .reordered2 type=kotlin.Int operator=null
|
||||
CALL .foo type=kotlin.Unit operator=null
|
||||
a: GET_VAR tmp2_a type=kotlin.Int operator=null
|
||||
b: CONST Int type=kotlin.Int value='1'
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo(x: Int, y: Int) = x
|
||||
fun bar(x: Int) = foo(x, 1)
|
||||
fun qux(x: Int) = foo(foo(x, x), x)
|
||||
|
||||
fun Int.ext1() = this
|
||||
fun Int.ext2(x: Int) = foo(this, x)
|
||||
fun Int.ext3(x: Int) = foo(ext1(), x)
|
||||
@@ -0,0 +1,36 @@
|
||||
FILE /calls.kt
|
||||
FUN public fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_VAR x type=kotlin.Int operator=null
|
||||
FUN public fun bar(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .foo type=kotlin.Int operator=null
|
||||
x: GET_VAR x type=kotlin.Int operator=null
|
||||
y: CONST Int type=kotlin.Int value='1'
|
||||
FUN public fun qux(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .foo type=kotlin.Int operator=null
|
||||
x: CALL .foo type=kotlin.Int operator=null
|
||||
x: GET_VAR x type=kotlin.Int operator=null
|
||||
y: GET_VAR x type=kotlin.Int operator=null
|
||||
y: GET_VAR x type=kotlin.Int operator=null
|
||||
FUN public fun kotlin.Int.ext1(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
$RECEIVER of: ext1 type=kotlin.Int
|
||||
FUN public fun kotlin.Int.ext2(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .foo type=kotlin.Int operator=null
|
||||
x: $RECEIVER of: ext2 type=kotlin.Int
|
||||
y: GET_VAR x type=kotlin.Int operator=null
|
||||
FUN public fun kotlin.Int.ext3(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .foo type=kotlin.Int operator=null
|
||||
x: CALL .ext1 type=kotlin.Int operator=null
|
||||
$receiver: $RECEIVER of: ext3 type=kotlin.Int
|
||||
y: GET_VAR x type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
fun foo(): C = this
|
||||
fun bar(): C? = this
|
||||
}
|
||||
|
||||
fun test(nc: C?) =
|
||||
nc?.foo()?.bar()?.foo()?.foo()
|
||||
@@ -0,0 +1,31 @@
|
||||
FILE /chainOfSafeCalls.kt
|
||||
CLASS CLASS C
|
||||
FUN public final fun foo(): C
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
THIS public final class C type=C
|
||||
FUN public final fun bar(): C?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
THIS public final class C type=C
|
||||
FUN public fun test(/*0*/ nc: C?): C?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=C? operator=SAFE_CALL
|
||||
VAR val tmp2_safe_receiver: C?
|
||||
WHEN type=C? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR nc type=C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .bar type=C? operator=null
|
||||
$this: CALL .foo type=C operator=null
|
||||
$this: GET_VAR nc type=C? operator=null
|
||||
WHEN type=C? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp2_safe_receiver type=C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .foo type=C operator=null
|
||||
$this: CALL .foo type=C operator=null
|
||||
$this: GET_VAR tmp2_safe_receiver type=C? operator=null
|
||||
@@ -0,0 +1,10 @@
|
||||
interface IA
|
||||
|
||||
interface IB {
|
||||
operator fun IA.compareTo(other: IA): Int
|
||||
}
|
||||
|
||||
fun IB.test1(a1: IA, a2: IA) = a1 > a2
|
||||
fun IB.test2(a1: IA, a2: IA) = a1 >= a2
|
||||
fun IB.test3(a1: IA, a2: IA) = a1 < a2
|
||||
fun IB.test4(a1: IA, a2: IA) = a1 <= a2
|
||||
@@ -0,0 +1,36 @@
|
||||
FILE /conventionComparisons.kt
|
||||
CLASS INTERFACE IA
|
||||
CLASS INTERFACE IB
|
||||
FUN public abstract operator fun IA.compareTo(/*0*/ other: IA): kotlin.Int
|
||||
FUN public fun IB.test1(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: $RECEIVER of: test1 type=IB
|
||||
$receiver: GET_VAR a1 type=IA operator=null
|
||||
other: GET_VAR a2 type=IA operator=null
|
||||
FUN public fun IB.test2(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: $RECEIVER of: test2 type=IB
|
||||
$receiver: GET_VAR a1 type=IA operator=null
|
||||
other: GET_VAR a2 type=IA operator=null
|
||||
FUN public fun IB.test3(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: $RECEIVER of: test3 type=IB
|
||||
$receiver: GET_VAR a1 type=IA operator=null
|
||||
other: GET_VAR a2 type=IA operator=null
|
||||
FUN public fun IB.test4(/*0*/ a1: IA, /*1*/ a2: IA): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: $RECEIVER of: test4 type=IB
|
||||
$receiver: GET_VAR a1 type=IA operator=null
|
||||
other: GET_VAR a2 type=IA operator=null
|
||||
@@ -0,0 +1,10 @@
|
||||
object A
|
||||
|
||||
object B {
|
||||
operator fun A.component1() = 1
|
||||
operator fun A.component2() = 2
|
||||
}
|
||||
|
||||
fun B.test() { // <<< destructuring1.txt
|
||||
val (x, y) = A
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
FUN public fun B.test(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=DESTRUCTURING_DECLARATION
|
||||
VAR val tmp0_container: A
|
||||
GET_OBJECT A type=A
|
||||
VAR val x: kotlin.Int
|
||||
CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1)
|
||||
$this: $RECEIVER of: test type=B
|
||||
$receiver: GET_VAR tmp0_container type=A operator=null
|
||||
VAR val y: kotlin.Int
|
||||
CALL .component2 type=kotlin.Int operator=COMPONENT_N(index=2)
|
||||
$this: $RECEIVER of: test type=B
|
||||
$receiver: GET_VAR tmp0_container type=A operator=null
|
||||
@@ -0,0 +1,2 @@
|
||||
fun length(s: String) = s.length
|
||||
fun lengthN(s: String?) = s?.length
|
||||
@@ -0,0 +1,16 @@
|
||||
FILE /dotQualified.kt
|
||||
FUN public fun length(/*0*/ s: kotlin.String): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR s type=kotlin.String operator=null
|
||||
FUN public fun lengthN(/*0*/ s: kotlin.String?): kotlin.Int?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR s type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR s type=kotlin.String? operator=null
|
||||
@@ -0,0 +1,17 @@
|
||||
val p: Any? = null
|
||||
|
||||
fun foo(): Any? = null
|
||||
|
||||
fun test1(a: Any?, b: Any) = a ?: b
|
||||
|
||||
fun test2(a: String?, b: Any) = a ?: b
|
||||
|
||||
fun test3(a: Any?, b: Any?): String {
|
||||
if (b !is String) return ""
|
||||
if (a !is String?) return ""
|
||||
return a ?: b
|
||||
}
|
||||
|
||||
fun test4(x: Any) = p ?: x
|
||||
|
||||
fun test5(x: Any) = foo() ?: x
|
||||
@@ -0,0 +1,74 @@
|
||||
FILE /elvis.kt
|
||||
PROPERTY public val p: kotlin.Any? = null getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Null type=kotlin.Nothing? value='null'
|
||||
FUN public fun foo(): kotlin.Any?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Null type=kotlin.Nothing? value='null'
|
||||
FUN public fun test1(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any): kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.Any operator=ELVIS
|
||||
WHEN type=kotlin.Any operator=null
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR a type=kotlin.Any? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: GET_VAR b type=kotlin.Any operator=null
|
||||
else: GET_VAR a type=kotlin.Any? operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.String?, /*1*/ b: kotlin.Any): kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.Any operator=ELVIS
|
||||
WHEN type=kotlin.Any operator=null
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR a type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: GET_VAR b type=kotlin.Any operator=null
|
||||
else: GET_VAR a type=kotlin.String? operator=null
|
||||
FUN public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.String
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR b type=kotlin.Any? operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value=''
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String?
|
||||
GET_VAR a type=kotlin.Any? operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value=''
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.String operator=ELVIS
|
||||
WHEN type=kotlin.String operator=null
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR a type=kotlin.Any? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR b type=kotlin.Any? operator=null
|
||||
else: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR a type=kotlin.Any? operator=null
|
||||
FUN public fun test4(/*0*/ x: kotlin.Any): kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.Any operator=ELVIS
|
||||
VAR val tmp0_elvis_lhs: kotlin.Any?
|
||||
CALL .<get-p> type=kotlin.Any? operator=GET_PROPERTY
|
||||
WHEN type=kotlin.Any operator=null
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_elvis_lhs type=kotlin.Any? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: GET_VAR x type=kotlin.Any operator=null
|
||||
else: GET_VAR tmp0_elvis_lhs type=kotlin.Any? operator=null
|
||||
FUN public fun test5(/*0*/ x: kotlin.Any): kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.Any operator=ELVIS
|
||||
VAR val tmp0_elvis_lhs: kotlin.Any?
|
||||
CALL .foo type=kotlin.Any? operator=null
|
||||
WHEN type=kotlin.Any operator=null
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_elvis_lhs type=kotlin.Any? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: GET_VAR x type=kotlin.Any operator=null
|
||||
else: GET_VAR tmp0_elvis_lhs type=kotlin.Any? operator=null
|
||||
@@ -0,0 +1,3 @@
|
||||
fun test1(a: Int, b: Int) = a == b
|
||||
fun test2(a: Int, b: Int) = a != b
|
||||
fun test3(a: Any?, b: Any?) = a == b
|
||||
@@ -0,0 +1,20 @@
|
||||
FILE /equality.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR a type=kotlin.Int operator=null
|
||||
arg1: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .NOT type=kotlin.Boolean operator=EXCLEQ
|
||||
arg0: CALL .EQEQ type=kotlin.Boolean operator=EXCLEQ
|
||||
arg0: GET_VAR a type=kotlin.Int operator=null
|
||||
arg1: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR a type=kotlin.Any? operator=null
|
||||
arg1: GET_VAR b type=kotlin.Any? operator=null
|
||||
@@ -0,0 +1,2 @@
|
||||
val String.okext: String get() = "OK"
|
||||
fun String.test5() = okext
|
||||
@@ -0,0 +1,11 @@
|
||||
FILE /extensionPropertyGetterCall.kt
|
||||
PROPERTY public val kotlin.String.okext: kotlin.String getter=<get-okext> setter=null
|
||||
PROPERTY_GETTER public fun kotlin.String.<get-okext>(): kotlin.String property=okext
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value='OK'
|
||||
FUN public fun kotlin.String.test5(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-okext> type=kotlin.String operator=GET_PROPERTY
|
||||
$receiver: $RECEIVER of: test5 type=kotlin.String
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun testEmpty(ss: List<String>) {
|
||||
for (s in ss);
|
||||
}
|
||||
|
||||
fun testIterable(ss: List<String>) {
|
||||
for (s in ss) {
|
||||
println(s)
|
||||
}
|
||||
}
|
||||
|
||||
fun testDestructuring(pp: List<Pair<Int, String>>) {
|
||||
for ((i, s) in pp) {
|
||||
println(i)
|
||||
println(s)
|
||||
}
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
FILE /for.kt
|
||||
FUN public fun testEmpty(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=null operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
FUN public fun testIterable(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=null operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
message: GET_VAR s type=kotlin.String operator=null
|
||||
FUN public fun testDestructuring(/*0*/ pp: kotlin.collections.List<kotlin.Pair<kotlin.Int, kotlin.String>>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR pp type=kotlin.collections.List<kotlin.Pair<kotlin.Int, kotlin.String>> operator=null
|
||||
WHILE label=null operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val tmp1_loop_parameter: kotlin.Pair<kotlin.Int, kotlin.String>
|
||||
CALL .next type=kotlin.Pair<kotlin.Int, kotlin.String> operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.Pair<kotlin.Int, kotlin.String>> operator=null
|
||||
VAR val i: kotlin.Int
|
||||
CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1)
|
||||
$this: GET_VAR tmp1_loop_parameter type=kotlin.Pair<kotlin.Int, kotlin.String> operator=null
|
||||
VAR val s: kotlin.String
|
||||
CALL .component2 type=kotlin.String operator=COMPONENT_N(index=2)
|
||||
$this: GET_VAR tmp1_loop_parameter type=kotlin.Pair<kotlin.Int, kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
message: GET_VAR i type=kotlin.Int operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
message: GET_VAR s type=kotlin.String operator=null
|
||||
@@ -0,0 +1,33 @@
|
||||
fun testForBreak1(ss: List<String>) {
|
||||
for (s in ss) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
fun testForBreak2(ss: List<String>) {
|
||||
OUTER@for (s1 in ss) {
|
||||
INNER@for (s2 in ss) {
|
||||
break@OUTER
|
||||
break@INNER
|
||||
break
|
||||
}
|
||||
break@OUTER
|
||||
}
|
||||
}
|
||||
|
||||
fun testForContinue1(ss: List<String>) {
|
||||
for (s in ss) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
fun testForContinue2(ss: List<String>) {
|
||||
OUTER@for (s1 in ss) {
|
||||
INNER@for (s2 in ss) {
|
||||
continue@OUTER
|
||||
continue@INNER
|
||||
continue
|
||||
}
|
||||
continue@OUTER
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
FILE /forWithBreakContinue.kt
|
||||
FUN public fun testForBreak1(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=null operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Nothing operator=null
|
||||
BREAK label=null depth=0
|
||||
FUN public fun testForBreak2(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=OUTER operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s1: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Nothing operator=null
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp1_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=INNER operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp1_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s2: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp1_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Nothing operator=null
|
||||
BREAK label=OUTER depth=1
|
||||
BREAK label=INNER depth=0
|
||||
BREAK label=null depth=0
|
||||
BREAK label=OUTER depth=0
|
||||
FUN public fun testForContinue1(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=null operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Nothing operator=null
|
||||
CONTINUE label=null depth=0
|
||||
FUN public fun testForContinue2(/*0*/ ss: kotlin.collections.List<kotlin.String>): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=OUTER operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s1: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp0_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Nothing operator=null
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp1_iterator: kotlin.collections.Iterator<kotlin.String>
|
||||
CALL .iterator type=kotlin.collections.Iterator<kotlin.String> operator=FOR_LOOP_ITERATOR
|
||||
$this: GET_VAR ss type=kotlin.collections.List<kotlin.String> operator=null
|
||||
WHILE label=INNER operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: GET_VAR tmp1_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val s2: kotlin.String
|
||||
CALL .next type=kotlin.String operator=FOR_LOOP_NEXT
|
||||
$this: GET_VAR tmp1_iterator type=kotlin.collections.Iterator<kotlin.String> operator=null
|
||||
BLOCK type=kotlin.Nothing operator=null
|
||||
CONTINUE label=OUTER depth=1
|
||||
CONTINUE label=INNER depth=0
|
||||
CONTINUE label=null depth=0
|
||||
CONTINUE label=OUTER depth=0
|
||||
@@ -0,0 +1,15 @@
|
||||
object FiveTimes
|
||||
|
||||
class IntCell(var value: Int)
|
||||
|
||||
interface IReceiver {
|
||||
operator fun FiveTimes.iterator() = IntCell(5)
|
||||
operator fun IntCell.hasNext() = value > 0
|
||||
operator fun IntCell.next() = value--
|
||||
}
|
||||
|
||||
fun IReceiver.test() {
|
||||
for (i in FiveTimes) {
|
||||
println(i)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
FILE /forWithImplicitReceivers.kt
|
||||
CLASS OBJECT FiveTimes
|
||||
CLASS CLASS IntCell
|
||||
PROPERTY public final var value: kotlin.Int getter=null setter=null
|
||||
CLASS INTERFACE IReceiver
|
||||
FUN public open operator fun FiveTimes.iterator(): IntCell
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<init> type=IntCell operator=null
|
||||
value: CONST Int type=kotlin.Int value='5'
|
||||
FUN public open operator fun IntCell.hasNext(): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: CALL .<get-value> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: $RECEIVER of: hasNext type=IntCell
|
||||
other: CONST Int type=kotlin.Int value='0'
|
||||
FUN public open operator fun IntCell.next(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_DECR
|
||||
VAR val tmp0: kotlin.Int
|
||||
CALL .<get-value> type=kotlin.Int operator=POSTFIX_DECR
|
||||
$this: $RECEIVER of: next type=IntCell
|
||||
CALL .<set-value> type=kotlin.Unit operator=POSTFIX_DECR
|
||||
$this: $RECEIVER of: next type=IntCell
|
||||
<set-?>: CALL .dec type=kotlin.Int operator=POSTFIX_DECR
|
||||
$this: GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
FUN public fun IReceiver.test(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Unit operator=FOR_LOOP
|
||||
VAR val tmp0_iterator: IntCell
|
||||
CALL .iterator type=IntCell operator=FOR_LOOP_ITERATOR
|
||||
$this: $RECEIVER of: test type=IReceiver
|
||||
$receiver: GET_OBJECT FiveTimes type=FiveTimes
|
||||
WHILE label=null operator=FOR_LOOP_INNER_WHILE
|
||||
condition: CALL .hasNext type=kotlin.Boolean operator=FOR_LOOP_HAS_NEXT
|
||||
$this: $RECEIVER of: test type=IReceiver
|
||||
$receiver: GET_VAR tmp0_iterator type=IntCell operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=FOR_LOOP_INNER_WHILE
|
||||
VAR val i: kotlin.Int
|
||||
CALL .next type=kotlin.Int operator=FOR_LOOP_NEXT
|
||||
$this: $RECEIVER of: test type=IReceiver
|
||||
$receiver: GET_VAR tmp0_iterator type=IntCell operator=null
|
||||
BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
message: GET_VAR i type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,3 @@
|
||||
fun test1(a: Int, b: Int) = a === b
|
||||
fun test2(a: Int, b: Int) = a !== b
|
||||
fun test3(a: Any?, b: Any?) = a === b
|
||||
@@ -0,0 +1,20 @@
|
||||
FILE /identity.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .EQEQEQ type=kotlin.Boolean operator=EQEQEQ
|
||||
arg0: GET_VAR a type=kotlin.Int operator=null
|
||||
arg1: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .NOT type=kotlin.Boolean operator=EXCLEQEQ
|
||||
arg0: CALL .EQEQEQ type=kotlin.Boolean operator=EXCLEQEQ
|
||||
arg0: GET_VAR a type=kotlin.Int operator=null
|
||||
arg1: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test3(/*0*/ a: kotlin.Any?, /*1*/ b: kotlin.Any?): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .EQEQEQ type=kotlin.Boolean operator=EQEQEQ
|
||||
arg0: GET_VAR a type=kotlin.Any? operator=null
|
||||
arg1: GET_VAR b type=kotlin.Any? operator=null
|
||||
@@ -0,0 +1,4 @@
|
||||
fun test(i: Int) =
|
||||
if (i > 0) 1
|
||||
else if (i < 0) -1
|
||||
else 0
|
||||
@@ -0,0 +1,17 @@
|
||||
FILE /ifElseIf.kt
|
||||
FUN public fun test(/*0*/ i: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Int operator=WHEN
|
||||
if: CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR i type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='0'
|
||||
then: CONST Int type=kotlin.Int value='1'
|
||||
if: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR i type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='0'
|
||||
then: CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||
$this: CONST Int type=kotlin.Int value='1'
|
||||
else: CONST Int type=kotlin.Int value='0'
|
||||
@@ -0,0 +1,2 @@
|
||||
fun test(): String =
|
||||
System.getProperty("test")
|
||||
@@ -0,0 +1,7 @@
|
||||
FILE /implicitCastOnPlatformType.kt
|
||||
FUN public fun test(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
TYPE_OP operator=IMPLICIT_NOTNULL typeOperand=kotlin.String
|
||||
CALL .getProperty type=kotlin.String! operator=null
|
||||
p0: CONST String type=kotlin.String value='test'
|
||||
@@ -0,0 +1,4 @@
|
||||
fun test1(a: Any, x: Collection<Any>) = a in x
|
||||
fun test2(a: Any, x: Collection<Any>) = a !in x
|
||||
fun <T> test3(a: T, x: Collection<T>) = a in x
|
||||
fun <T> test4(a: T, x: Collection<T>) = a !in x
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
FILE /in.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.Any, /*1*/ x: kotlin.collections.Collection<kotlin.Any>): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .contains type=kotlin.Boolean operator=IN
|
||||
$this: GET_VAR x type=kotlin.collections.Collection<kotlin.Any> operator=null
|
||||
element: GET_VAR a type=kotlin.Any operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.Any, /*1*/ x: kotlin.collections.Collection<kotlin.Any>): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .NOT type=kotlin.Boolean operator=NOT_IN
|
||||
arg0: CALL .contains type=kotlin.Boolean operator=NOT_IN
|
||||
$this: GET_VAR x type=kotlin.collections.Collection<kotlin.Any> operator=null
|
||||
element: GET_VAR a type=kotlin.Any operator=null
|
||||
FUN public fun </*0*/ T> test3(/*0*/ a: T, /*1*/ x: kotlin.collections.Collection<T>): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .contains type=kotlin.Boolean operator=IN
|
||||
$this: GET_VAR x type=kotlin.collections.Collection<T> operator=null
|
||||
element: GET_VAR a type=T operator=null
|
||||
FUN public fun </*0*/ T> test4(/*0*/ a: T, /*1*/ x: kotlin.collections.Collection<T>): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .NOT type=kotlin.Boolean operator=NOT_IN
|
||||
arg0: CALL .contains type=kotlin.Boolean operator=NOT_IN
|
||||
$this: GET_VAR x type=kotlin.collections.Collection<T> operator=null
|
||||
element: GET_VAR a type=T operator=null
|
||||
@@ -0,0 +1,34 @@
|
||||
var p: Int = 0
|
||||
val arr = intArrayOf(1, 2, 3)
|
||||
|
||||
fun testVarPrefix() {
|
||||
var x = 0
|
||||
val x1 = ++x
|
||||
val x2 = --x
|
||||
}
|
||||
|
||||
fun testVarPostfix() {
|
||||
var x = 0
|
||||
val x1 = x++
|
||||
val x2 = x--
|
||||
}
|
||||
|
||||
fun testPropPrefix() {
|
||||
val p1 = ++p
|
||||
val p2 = --p
|
||||
}
|
||||
|
||||
fun testPropPostfix() {
|
||||
val p1 = p++
|
||||
val p2 = --p
|
||||
}
|
||||
|
||||
fun testArrayPrefix() {
|
||||
val a1 = ++arr[0]
|
||||
val a2 = --arr[0]
|
||||
}
|
||||
|
||||
fun testArrayPostfix() {
|
||||
val a1 = arr[0]++
|
||||
val a2 = arr[0]--
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
FILE /incrementDecrement.kt
|
||||
PROPERTY public var p: kotlin.Int getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
PROPERTY public val arr: kotlin.IntArray getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
elements: VARARG type=IntArray varargElementType=Int
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
CONST Int type=kotlin.Int value='3'
|
||||
FUN public fun testVarPrefix(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR var x: kotlin.Int
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
VAR val x1: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_INCR
|
||||
VAR val tmp0: kotlin.Int
|
||||
CALL .inc type=kotlin.Int operator=PREFIX_INCR
|
||||
$this: GET_VAR x type=kotlin.Int operator=PREFIX_INCR
|
||||
SET_VAR x type=kotlin.Unit operator=PREFIX_INCR
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
VAR val x2: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_DECR
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
||||
$this: GET_VAR x type=kotlin.Int operator=PREFIX_DECR
|
||||
SET_VAR x type=kotlin.Unit operator=PREFIX_DECR
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
FUN public fun testVarPostfix(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR var x: kotlin.Int
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
VAR val x1: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp0: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=POSTFIX_INCR
|
||||
SET_VAR x type=kotlin.Unit operator=POSTFIX_INCR
|
||||
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
VAR val x2: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_DECR
|
||||
VAR val tmp1: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=POSTFIX_DECR
|
||||
SET_VAR x type=kotlin.Unit operator=POSTFIX_DECR
|
||||
CALL .dec type=kotlin.Int operator=POSTFIX_DECR
|
||||
$this: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
FUN public fun testPropPrefix(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val p1: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_INCR
|
||||
VAR val tmp0: kotlin.Int
|
||||
CALL .inc type=kotlin.Int operator=PREFIX_INCR
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=PREFIX_INCR
|
||||
CALL .<set-p> type=kotlin.Unit operator=PREFIX_INCR
|
||||
<set-?>: GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
VAR val p2: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_DECR
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=PREFIX_DECR
|
||||
CALL .<set-p> type=kotlin.Unit operator=PREFIX_DECR
|
||||
<set-?>: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
FUN public fun testPropPostfix(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val p1: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp0: kotlin.Int
|
||||
CALL .<get-p> type=kotlin.Int operator=POSTFIX_INCR
|
||||
CALL .<set-p> type=kotlin.Unit operator=POSTFIX_INCR
|
||||
<set-?>: CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
VAR val p2: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_DECR
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
||||
$this: CALL .<get-p> type=kotlin.Int operator=PREFIX_DECR
|
||||
CALL .<set-p> type=kotlin.Unit operator=PREFIX_DECR
|
||||
<set-?>: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
FUN public fun testArrayPrefix(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val a1: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_INCR
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .inc type=kotlin.Int operator=PREFIX_INCR
|
||||
$this: CALL .get type=kotlin.Int operator=PREFIX_INCR
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=PREFIX_INCR
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
VAR val a2: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=PREFIX_DECR
|
||||
VAR val tmp2_array: kotlin.IntArray
|
||||
CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
|
||||
VAR val tmp3: kotlin.Int
|
||||
CALL .dec type=kotlin.Int operator=PREFIX_DECR
|
||||
$this: CALL .get type=kotlin.Int operator=PREFIX_DECR
|
||||
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=PREFIX_DECR
|
||||
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: GET_VAR tmp3 type=kotlin.Int operator=null
|
||||
GET_VAR tmp3 type=kotlin.Int operator=null
|
||||
FUN public fun testArrayPostfix(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val a1: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp0_array: kotlin.IntArray
|
||||
CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .get type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
VAR val a2: kotlin.Int
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_DECR
|
||||
VAR val tmp2_array: kotlin.IntArray
|
||||
CALL .<get-arr> type=kotlin.IntArray operator=GET_PROPERTY
|
||||
VAR val tmp3: kotlin.Int
|
||||
CALL .get type=kotlin.Int operator=POSTFIX_DECR
|
||||
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=POSTFIX_DECR
|
||||
$this: GET_VAR tmp2_array type=kotlin.IntArray operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: CALL .dec type=kotlin.Int operator=POSTFIX_DECR
|
||||
$this: GET_VAR tmp3 type=kotlin.Int operator=null
|
||||
GET_VAR tmp3 type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,6 @@
|
||||
val test1 = 1
|
||||
val test2 = -1
|
||||
val test3 = true
|
||||
val test4 = false
|
||||
val test5 = "abc"
|
||||
val test6 = null
|
||||
@@ -0,0 +1,20 @@
|
||||
FILE /literals.kt
|
||||
PROPERTY public val test1: kotlin.Int = 1 getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
PROPERTY public val test2: kotlin.Int = -1 getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||
$this: CONST Int type=kotlin.Int value='1'
|
||||
PROPERTY public val test3: kotlin.Boolean = true getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Boolean type=kotlin.Boolean value='true'
|
||||
PROPERTY public val test4: kotlin.Boolean = false getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Boolean type=kotlin.Boolean value='false'
|
||||
PROPERTY public val test5: kotlin.String = "abc" getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value='abc'
|
||||
PROPERTY public val test6: kotlin.Nothing? = null getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Null type=kotlin.Nothing? value='null'
|
||||
@@ -0,0 +1,29 @@
|
||||
fun btest1(a: Byte, b: Byte) = a > b
|
||||
fun btest2(a: Byte, b: Byte) = a < b
|
||||
fun btest3(a: Byte, b: Byte) = a >= b
|
||||
fun btest4(a: Byte, b: Byte) = a <= b
|
||||
|
||||
fun stest1(a: Short, b: Short) = a > b
|
||||
fun stest2(a: Short, b: Short) = a < b
|
||||
fun stest3(a: Short, b: Short) = a >= b
|
||||
fun stest4(a: Short, b: Short) = a <= b
|
||||
|
||||
fun itest1(a: Int, b: Int) = a > b
|
||||
fun itest2(a: Int, b: Int) = a < b
|
||||
fun itest3(a: Int, b: Int) = a >= b
|
||||
fun itest4(a: Int, b: Int) = a <= b
|
||||
|
||||
fun ltest1(a: Long, b: Long) = a > b
|
||||
fun ltest2(a: Long, b: Long) = a < b
|
||||
fun ltest3(a: Long, b: Long) = a >= b
|
||||
fun ltest4(a: Long, b: Long) = a <= b
|
||||
|
||||
fun ftest1(a: Float, b: Float) = a > b
|
||||
fun ftest2(a: Float, b: Float) = a < b
|
||||
fun ftest3(a: Float, b: Float) = a >= b
|
||||
fun ftest4(a: Float, b: Float) = a <= b
|
||||
|
||||
fun dtest1(a: Double, b: Double) = a > b
|
||||
fun dtest2(a: Double, b: Double) = a < b
|
||||
fun dtest3(a: Double, b: Double) = a >= b
|
||||
fun dtest4(a: Double, b: Double) = a <= b
|
||||
@@ -0,0 +1,169 @@
|
||||
FILE /primitiveComparisons.kt
|
||||
FUN public fun btest1(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.Byte operator=null
|
||||
other: GET_VAR b type=kotlin.Byte operator=null
|
||||
FUN public fun btest2(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.Byte operator=null
|
||||
other: GET_VAR b type=kotlin.Byte operator=null
|
||||
FUN public fun btest3(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.Byte operator=null
|
||||
other: GET_VAR b type=kotlin.Byte operator=null
|
||||
FUN public fun btest4(/*0*/ a: kotlin.Byte, /*1*/ b: kotlin.Byte): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.Byte operator=null
|
||||
other: GET_VAR b type=kotlin.Byte operator=null
|
||||
FUN public fun stest1(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.Short operator=null
|
||||
other: GET_VAR b type=kotlin.Short operator=null
|
||||
FUN public fun stest2(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.Short operator=null
|
||||
other: GET_VAR b type=kotlin.Short operator=null
|
||||
FUN public fun stest3(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.Short operator=null
|
||||
other: GET_VAR b type=kotlin.Short operator=null
|
||||
FUN public fun stest4(/*0*/ a: kotlin.Short, /*1*/ b: kotlin.Short): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.Short operator=null
|
||||
other: GET_VAR b type=kotlin.Short operator=null
|
||||
FUN public fun itest1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun itest2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun itest3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun itest4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun ltest1(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.Long operator=null
|
||||
other: GET_VAR b type=kotlin.Long operator=null
|
||||
FUN public fun ltest2(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.Long operator=null
|
||||
other: GET_VAR b type=kotlin.Long operator=null
|
||||
FUN public fun ltest3(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.Long operator=null
|
||||
other: GET_VAR b type=kotlin.Long operator=null
|
||||
FUN public fun ltest4(/*0*/ a: kotlin.Long, /*1*/ b: kotlin.Long): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.Long operator=null
|
||||
other: GET_VAR b type=kotlin.Long operator=null
|
||||
FUN public fun ftest1(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.Float operator=null
|
||||
other: GET_VAR b type=kotlin.Float operator=null
|
||||
FUN public fun ftest2(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.Float operator=null
|
||||
other: GET_VAR b type=kotlin.Float operator=null
|
||||
FUN public fun ftest3(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.Float operator=null
|
||||
other: GET_VAR b type=kotlin.Float operator=null
|
||||
FUN public fun ftest4(/*0*/ a: kotlin.Float, /*1*/ b: kotlin.Float): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.Float operator=null
|
||||
other: GET_VAR b type=kotlin.Float operator=null
|
||||
FUN public fun dtest1(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.Double operator=null
|
||||
other: GET_VAR b type=kotlin.Double operator=null
|
||||
FUN public fun dtest2(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.Double operator=null
|
||||
other: GET_VAR b type=kotlin.Double operator=null
|
||||
FUN public fun dtest3(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.Double operator=null
|
||||
other: GET_VAR b type=kotlin.Double operator=null
|
||||
FUN public fun dtest4(/*0*/ a: kotlin.Double, /*1*/ b: kotlin.Double): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.Double operator=null
|
||||
other: GET_VAR b type=kotlin.Double operator=null
|
||||
@@ -0,0 +1,17 @@
|
||||
val ok = "OK"
|
||||
val ok2 = ok
|
||||
val ok3: String get() = "OK"
|
||||
|
||||
fun test1() = ok
|
||||
|
||||
fun test2(x: String) = x
|
||||
|
||||
fun test3(): String {
|
||||
val x = "OK"
|
||||
return x
|
||||
}
|
||||
|
||||
fun test4() = ok3
|
||||
|
||||
val String.okext: String get() = "OK"
|
||||
fun String.test5() = okext
|
||||
@@ -0,0 +1,40 @@
|
||||
FILE /references.kt
|
||||
PROPERTY public val ok: kotlin.String = "OK" getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST String type=kotlin.String value='OK'
|
||||
PROPERTY public val ok2: kotlin.String = "OK" getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .<get-ok> type=kotlin.String operator=GET_PROPERTY
|
||||
PROPERTY public val ok3: kotlin.String getter=<get-ok3> setter=null
|
||||
PROPERTY_GETTER public fun <get-ok3>(): kotlin.String property=ok3
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value='OK'
|
||||
FUN public fun test1(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-ok> type=kotlin.String operator=GET_PROPERTY
|
||||
FUN public fun test2(/*0*/ x: kotlin.String): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_VAR x type=kotlin.String operator=null
|
||||
FUN public fun test3(): kotlin.String
|
||||
BLOCK_BODY
|
||||
VAR val x: kotlin.String = "OK"
|
||||
CONST String type=kotlin.String value='OK'
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_VAR x type=kotlin.String operator=null
|
||||
FUN public fun test4(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-ok3> type=kotlin.String operator=GET_PROPERTY
|
||||
PROPERTY public val kotlin.String.okext: kotlin.String getter=<get-okext> setter=null
|
||||
PROPERTY_GETTER public fun kotlin.String.<get-okext>(): kotlin.String property=okext
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value='OK'
|
||||
FUN public fun kotlin.String.test5(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-okext> type=kotlin.String operator=GET_PROPERTY
|
||||
$receiver: $RECEIVER of: test5 type=kotlin.String
|
||||
@@ -0,0 +1,20 @@
|
||||
package test
|
||||
|
||||
class C
|
||||
|
||||
var C?.p: Int
|
||||
get() = 42
|
||||
set(value) {}
|
||||
|
||||
operator fun Int?.inc(): Int? = this?.inc()
|
||||
|
||||
operator fun Int?.get(index: Int): Int = 42
|
||||
operator fun Int?.set(index: Int, value: Int) {}
|
||||
|
||||
fun testProperty(nc: C?) {
|
||||
nc?.p++
|
||||
}
|
||||
|
||||
fun testArrayAccess(nc: C?) {
|
||||
nc?.p[0]++
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
FILE /safeCallWithIncrementDecrement.kt
|
||||
CLASS CLASS C
|
||||
PROPERTY public var test.C?.p: kotlin.Int getter=<get-p> setter=<set-p>
|
||||
PROPERTY_GETTER public fun test.C?.<get-p>(): kotlin.Int property=p
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
PROPERTY_SETTER public fun test.C?.<set-p>(/*0*/ value: kotlin.Int): kotlin.Unit property=p
|
||||
BLOCK_BODY
|
||||
FUN public operator fun kotlin.Int?.inc(): kotlin.Int?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: $RECEIVER of: inc type=kotlin.Int?
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .inc type=kotlin.Int operator=null
|
||||
$this: $RECEIVER of: inc type=kotlin.Int?
|
||||
FUN public operator fun kotlin.Int?.get(/*0*/ index: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
FUN public operator fun kotlin.Int?.set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.Int): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public fun testProperty(/*0*/ nc: test.C?): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR nc type=test.C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp1: kotlin.Int
|
||||
CALL .<get-p> type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR nc type=test.C? operator=null
|
||||
CALL .<set-p> type=kotlin.Unit operator=POSTFIX_INCR
|
||||
$this: GET_VAR nc type=test.C? operator=null
|
||||
value: CALL .inc type=kotlin.Int? operator=POSTFIX_INCR
|
||||
$receiver: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
FUN public fun testArrayAccess(/*0*/ nc: test.C?): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp3_array: kotlin.Int?
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR nc type=test.C? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-p> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR nc type=test.C? operator=null
|
||||
VAR val tmp4: kotlin.Int
|
||||
CALL .get type=kotlin.Int operator=POSTFIX_INCR
|
||||
$receiver: GET_VAR tmp3_array type=kotlin.Int? operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
CALL .set type=kotlin.Unit operator=POSTFIX_INCR
|
||||
$receiver: GET_VAR tmp3_array type=kotlin.Int? operator=null
|
||||
index: CONST Int type=kotlin.Int value='0'
|
||||
value: CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp4 type=kotlin.Int operator=null
|
||||
GET_VAR tmp4 type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,15 @@
|
||||
class Ref(var value: Int)
|
||||
|
||||
interface IHost {
|
||||
fun String.extLength() = length
|
||||
}
|
||||
|
||||
fun test1(x: String?) = x?.length
|
||||
fun test2(x: String?) = x?.hashCode()
|
||||
fun test3(x: String?, y: Any?) = x?.equals(y)
|
||||
|
||||
fun test4(x: Ref?) {
|
||||
x?.value = 0
|
||||
}
|
||||
|
||||
fun IHost.test5(s: String?) = s?.extLength()
|
||||
@@ -0,0 +1,61 @@
|
||||
FILE /safeCalls.kt
|
||||
CLASS CLASS Ref
|
||||
PROPERTY public final var value: kotlin.Int getter=null setter=null
|
||||
CLASS INTERFACE IHost
|
||||
FUN public open fun kotlin.String.extLength(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: $RECEIVER of: extLength type=kotlin.String
|
||||
FUN public fun test1(/*0*/ x: kotlin.String?): kotlin.Int?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: GET_VAR x type=kotlin.String? operator=null
|
||||
FUN public fun test2(/*0*/ x: kotlin.String?): kotlin.Int?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .hashCode type=kotlin.Int operator=null
|
||||
$this: GET_VAR x type=kotlin.String? operator=null
|
||||
FUN public fun test3(/*0*/ x: kotlin.String?, /*1*/ y: kotlin.Any?): kotlin.Boolean?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Boolean? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .equals type=kotlin.Boolean operator=null
|
||||
$this: GET_VAR x type=kotlin.String? operator=null
|
||||
other: GET_VAR y type=kotlin.Any? operator=null
|
||||
FUN public fun test4(/*0*/ x: Ref?): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=Ref? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .<set-value> type=kotlin.Unit operator=EQ
|
||||
$this: GET_VAR x type=Ref? operator=null
|
||||
<set-?>: CONST Int type=kotlin.Int value='0'
|
||||
FUN public fun IHost.test5(/*0*/ s: kotlin.String?): kotlin.Int?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.Int? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR s type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .extLength type=kotlin.Int operator=null
|
||||
$this: $RECEIVER of: test5 type=IHost
|
||||
$receiver: GET_VAR s type=kotlin.String? operator=null
|
||||
@@ -0,0 +1,12 @@
|
||||
fun test1(a: Int, b: Int) = a + b
|
||||
fun test2(a: Int, b: Int) = a - b
|
||||
fun test3(a: Int, b: Int) = a * b
|
||||
fun test4(a: Int, b: Int) = a / b
|
||||
fun test5(a: Int, b: Int) = a % b
|
||||
fun test6(a: Int, b: Int) = a .. b
|
||||
|
||||
fun test1x(a: Int, b: Int) = a.plus(b)
|
||||
fun test2x(a: Int, b: Int) = a.minus(b)
|
||||
fun test3x(a: Int, b: Int) = a.times(b)
|
||||
fun test4x(a: Int, b: Int) = a.div(b)
|
||||
fun test5x(a: Int, b: Int) = a.mod(b)
|
||||
@@ -0,0 +1,67 @@
|
||||
FILE /simpleOperators.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .minus type=kotlin.Int operator=MINUS
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test3(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .times type=kotlin.Int operator=MUL
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test4(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .div type=kotlin.Int operator=DIV
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test5(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .mod type=kotlin.Int operator=PERC
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test6(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.ranges.IntRange
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .rangeTo type=kotlin.ranges.IntRange operator=RANGE
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test1x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .plus type=kotlin.Int operator=null
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test2x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .minus type=kotlin.Int operator=null
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test3x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .times type=kotlin.Int operator=null
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test4x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .div type=kotlin.Int operator=null
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test5x(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .mod type=kotlin.Int operator=null
|
||||
$this: GET_VAR a type=kotlin.Int operator=null
|
||||
other: GET_VAR b type=kotlin.Int operator=null
|
||||
@@ -0,0 +1,8 @@
|
||||
fun test1(x: Int) = -x
|
||||
fun test2() = -42
|
||||
|
||||
fun test3(x: Int) = +x
|
||||
fun test4() = +42
|
||||
|
||||
fun test5(x: Boolean) = !x
|
||||
fun test6() = !true
|
||||
@@ -0,0 +1,31 @@
|
||||
FILE /simpleUnaryOperators.kt
|
||||
FUN public fun test1(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
FUN public fun test2(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .unaryMinus type=kotlin.Int operator=UMINUS
|
||||
$this: CONST Int type=kotlin.Int value='42'
|
||||
FUN public fun test3(/*0*/ x: kotlin.Int): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .unaryPlus type=kotlin.Int operator=UPLUS
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
FUN public fun test4(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .unaryPlus type=kotlin.Int operator=UPLUS
|
||||
$this: CONST Int type=kotlin.Int value='42'
|
||||
FUN public fun test5(/*0*/ x: kotlin.Boolean): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .not type=kotlin.Boolean operator=EXCL
|
||||
$this: GET_VAR x type=kotlin.Boolean operator=null
|
||||
FUN public fun test6(): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .not type=kotlin.Boolean operator=EXCL
|
||||
$this: CONST Boolean type=kotlin.Boolean value='true'
|
||||
@@ -0,0 +1,23 @@
|
||||
fun expectsString(s: String) {}
|
||||
fun expectsInt(i: Int) {}
|
||||
|
||||
fun overloaded(s: String) = s
|
||||
fun overloaded(x: Any) = x
|
||||
|
||||
fun test1(x: Any) {
|
||||
if (x !is String) return
|
||||
println(x.length)
|
||||
expectsString(x)
|
||||
expectsInt(x.length)
|
||||
expectsString(overloaded(x))
|
||||
}
|
||||
|
||||
fun test2(x: Any): String {
|
||||
if (x !is String) return ""
|
||||
return overloaded(x)
|
||||
}
|
||||
|
||||
fun test3(x: Any): String {
|
||||
if (x !is String) return ""
|
||||
return x
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
FILE /smartCasts.kt
|
||||
FUN public fun expectsString(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public fun expectsInt(/*0*/ i: kotlin.Int): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
FUN public fun overloaded(/*0*/ s: kotlin.String): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_VAR s type=kotlin.String operator=null
|
||||
FUN public fun overloaded(/*0*/ x: kotlin.Any): kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
FUN public fun test1(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
message: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
CALL .expectsString type=kotlin.Unit operator=null
|
||||
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
CALL .expectsInt type=kotlin.Unit operator=null
|
||||
i: CALL .<get-length> type=kotlin.Int operator=GET_PROPERTY
|
||||
$this: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
CALL .expectsString type=kotlin.Unit operator=null
|
||||
s: CALL .overloaded type=kotlin.String operator=null
|
||||
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
FUN public fun test2(/*0*/ x: kotlin.Any): kotlin.String
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value=''
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .overloaded type=kotlin.String operator=null
|
||||
s: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
FUN public fun test3(/*0*/ x: kotlin.Any): kotlin.String
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value=''
|
||||
RETURN type=kotlin.Nothing
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
@@ -0,0 +1,10 @@
|
||||
interface I1
|
||||
interface I2
|
||||
|
||||
operator fun I1.component1() = 1
|
||||
operator fun I2.component2() = ""
|
||||
|
||||
fun test(x: I1) {
|
||||
if (x !is I2) return
|
||||
val (c1, c2) = x
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
FILE /smartCastsWithDestructuring.kt
|
||||
CLASS INTERFACE I1
|
||||
CLASS INTERFACE I2
|
||||
FUN public operator fun I1.component1(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
FUN public operator fun I2.component2(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value=''
|
||||
FUN public fun test(/*0*/ x: I1): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=I2
|
||||
GET_VAR x type=I1 operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.Unit operator=DESTRUCTURING_DECLARATION
|
||||
VAR val c1: kotlin.Int
|
||||
CALL .component1 type=kotlin.Int operator=COMPONENT_N(index=1)
|
||||
$receiver: GET_VAR x type=I1 operator=null
|
||||
VAR val c2: kotlin.String
|
||||
CALL .component2 type=kotlin.String operator=COMPONENT_N(index=2)
|
||||
$receiver: TYPE_OP operator=IMPLICIT_CAST typeOperand=I2
|
||||
GET_VAR x type=I1 operator=null
|
||||
@@ -0,0 +1,12 @@
|
||||
fun testFun(): String { return "OK" }
|
||||
val testSimpleVal = 1
|
||||
val testValWithGetter: Int get() = 42
|
||||
var testSimpleVar = 2
|
||||
var testVarWithAccessors: Int
|
||||
get() = 42
|
||||
set(v) {}
|
||||
|
||||
// 1 FUN public fun testFun
|
||||
// 1 PROPERTY public val testSimpleVal
|
||||
// 2 PROPERTY_GETTER
|
||||
// 1 PROPERTY_SETTER
|
||||
@@ -0,0 +1,23 @@
|
||||
FILE /smoke.kt
|
||||
FUN public fun testFun(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST String type=kotlin.String value='OK'
|
||||
PROPERTY public val testSimpleVal: kotlin.Int = 1 getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='1'
|
||||
PROPERTY public val testValWithGetter: kotlin.Int getter=<get-testValWithGetter> setter=null
|
||||
PROPERTY_GETTER public fun <get-testValWithGetter>(): kotlin.Int property=testValWithGetter
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
PROPERTY public var testSimpleVar: kotlin.Int getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='2'
|
||||
PROPERTY public var testVarWithAccessors: kotlin.Int getter=<get-testVarWithAccessors> setter=<set-testVarWithAccessors>
|
||||
PROPERTY_GETTER public fun <get-testVarWithAccessors>(): kotlin.Int property=testVarWithAccessors
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
PROPERTY_SETTER public fun <set-testVarWithAccessors>(/*0*/ v: kotlin.Int): kotlin.Unit property=testVarWithAccessors
|
||||
BLOCK_BODY
|
||||
@@ -0,0 +1,4 @@
|
||||
fun test1(a: String, b: String) = a > b
|
||||
fun test2(a: String, b: String) = a < b
|
||||
fun test3(a: String, b: String) = a >= b
|
||||
fun test4(a: String, b: String) = a <= b
|
||||
@@ -0,0 +1,29 @@
|
||||
FILE /stringComparisons.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GT0 type=kotlin.Boolean operator=GT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GT
|
||||
$this: GET_VAR a type=kotlin.String operator=null
|
||||
other: GET_VAR b type=kotlin.String operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR a type=kotlin.String operator=null
|
||||
other: GET_VAR b type=kotlin.String operator=null
|
||||
FUN public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .GTEQ0 type=kotlin.Boolean operator=GTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=GTEQ
|
||||
$this: GET_VAR a type=kotlin.String operator=null
|
||||
other: GET_VAR b type=kotlin.String operator=null
|
||||
FUN public fun test4(/*0*/ a: kotlin.String, /*1*/ b: kotlin.String): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .LTEQ0 type=kotlin.Boolean operator=LTEQ
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LTEQ
|
||||
$this: GET_VAR a type=kotlin.String operator=null
|
||||
other: GET_VAR b type=kotlin.String operator=null
|
||||
@@ -0,0 +1,3 @@
|
||||
fun test1(a: String, b: Any) = a + b
|
||||
fun test2(a: String, b: Int) = a + "+" + b
|
||||
fun test3(a: String, b: Int) = (a + "+") + (b + 1) + a
|
||||
@@ -0,0 +1,24 @@
|
||||
FILE /stringPlus.kt
|
||||
FUN public fun test1(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Any): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR a type=kotlin.String operator=null
|
||||
GET_VAR b type=kotlin.Any operator=null
|
||||
FUN public fun test2(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR a type=kotlin.String operator=null
|
||||
CONST String type=kotlin.String value='+'
|
||||
GET_VAR b type=kotlin.Int operator=null
|
||||
FUN public fun test3(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
STRING_CONCATENATION type=kotlin.String
|
||||
GET_VAR a type=kotlin.String operator=null
|
||||
CONST String type=kotlin.String value='+'
|
||||
CALL .plus type=kotlin.Int operator=PLUS
|
||||
$this: GET_VAR b type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='1'
|
||||
GET_VAR a type=kotlin.String operator=null
|
||||
@@ -0,0 +1,9 @@
|
||||
fun test1() {
|
||||
throw Throwable()
|
||||
}
|
||||
|
||||
fun testImplicitCast(a: Any) {
|
||||
if (a is Throwable) {
|
||||
throw a
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
FILE /throw.kt
|
||||
FUN public fun test1(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
THROW type=kotlin.Nothing
|
||||
CALL .<init> type=kotlin.Throwable operator=null
|
||||
FUN public fun testImplicitCast(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.Throwable
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
then: BLOCK type=kotlin.Nothing operator=null
|
||||
THROW type=kotlin.Nothing
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Throwable
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
@@ -0,0 +1,25 @@
|
||||
fun test1() {
|
||||
try {
|
||||
println()
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
println()
|
||||
}
|
||||
finally {
|
||||
println()
|
||||
}
|
||||
}
|
||||
|
||||
fun test2(): Int {
|
||||
return try {
|
||||
println()
|
||||
42
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
println()
|
||||
24
|
||||
}
|
||||
finally {
|
||||
println()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
FILE /tryCatch.kt
|
||||
FUN public fun test1(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
TRY_CATCH type=kotlin.Unit
|
||||
try: BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
catch e: BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
finally: BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
FUN public fun test2(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
TRY_CATCH type=kotlin.Int
|
||||
try: BLOCK type=kotlin.Int operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
CONST Int type=kotlin.Int value='42'
|
||||
catch e: BLOCK type=kotlin.Int operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
CONST Int type=kotlin.Int value='24'
|
||||
finally: BLOCK type=kotlin.Unit operator=null
|
||||
CALL .println type=kotlin.Unit operator=null
|
||||
@@ -0,0 +1,5 @@
|
||||
fun testImplicitCast(a: Any) {
|
||||
if (a !is String) return
|
||||
|
||||
val t: String = try { a } catch (e: Throwable) { "" }
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
FILE /tryCatchWithImplicitCast.kt
|
||||
FUN public fun testImplicitCast(/*0*/ a: kotlin.Any): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
VAR val t: kotlin.String
|
||||
TRY_CATCH type=kotlin.String
|
||||
try: BLOCK type=kotlin.String operator=null
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.String
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
catch e: BLOCK type=kotlin.String operator=null
|
||||
CONST String type=kotlin.String value=''
|
||||
@@ -0,0 +1,6 @@
|
||||
interface IThing
|
||||
|
||||
fun test1(x: Any) = x is IThing
|
||||
fun test2(x: Any) = x !is IThing
|
||||
fun test3(x: Any) = x as IThing
|
||||
fun test4(x: Any) = x as? IThing
|
||||
@@ -0,0 +1,22 @@
|
||||
FILE /typeOperators.kt
|
||||
CLASS INTERFACE IThing
|
||||
FUN public fun test1(/*0*/ x: kotlin.Any): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
TYPE_OP operator=INSTANCEOF typeOperand=IThing
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
FUN public fun test2(/*0*/ x: kotlin.Any): kotlin.Boolean
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
TYPE_OP operator=NOT_INSTANCEOF typeOperand=IThing
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
FUN public fun test3(/*0*/ x: kotlin.Any): IThing
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
TYPE_OP operator=CAST typeOperand=IThing
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
FUN public fun test4(/*0*/ x: kotlin.Any): IThing?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
TYPE_OP operator=SAFE_CAST typeOperand=IThing
|
||||
GET_VAR x type=kotlin.Any operator=null
|
||||
@@ -0,0 +1,11 @@
|
||||
enum class Enum { A }
|
||||
object A
|
||||
val a = 0
|
||||
class Z {
|
||||
companion object
|
||||
}
|
||||
|
||||
fun test1() = Enum.A
|
||||
fun test2() = A
|
||||
fun test3() = a
|
||||
fun test4() = Z
|
||||
@@ -0,0 +1,25 @@
|
||||
FILE /values.kt
|
||||
CLASS ENUM_CLASS Enum
|
||||
CLASS ENUM_ENTRY A
|
||||
CLASS OBJECT A
|
||||
PROPERTY public val a: kotlin.Int = 0 getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
CLASS CLASS Z
|
||||
CLASS OBJECT Companion
|
||||
FUN public fun test1(): Enum
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_ENUM_VALUE A type=Enum
|
||||
FUN public fun test2(): A
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_OBJECT A type=A
|
||||
FUN public fun test3(): kotlin.Int
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .<get-a> type=kotlin.Int operator=GET_PROPERTY
|
||||
FUN public fun test4(): Z.Companion
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
GET_OBJECT Companion type=Z.Companion
|
||||
@@ -0,0 +1,3 @@
|
||||
val test1 = arrayOf<String>()
|
||||
val test2 = arrayOf("1", "2", "3")
|
||||
val test3 = arrayOf("0", *test2, *test1, "4")
|
||||
@@ -0,0 +1,21 @@
|
||||
FILE /vararg.kt
|
||||
PROPERTY public val test1: kotlin.Array<kotlin.String> getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .arrayOf type=kotlin.Array<kotlin.String> operator=null
|
||||
PROPERTY public val test2: kotlin.Array<kotlin.String> getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .arrayOf type=kotlin.Array<kotlin.String> operator=null
|
||||
elements: VARARG type=Array<out String> varargElementType=String
|
||||
CONST String type=kotlin.String value='1'
|
||||
CONST String type=kotlin.String value='2'
|
||||
CONST String type=kotlin.String value='3'
|
||||
PROPERTY public val test3: kotlin.Array<kotlin.String> getter=null setter=null
|
||||
EXPRESSION_BODY
|
||||
CALL .arrayOf type=kotlin.Array<kotlin.String> operator=null
|
||||
elements: VARARG type=Array<out String> varargElementType=String
|
||||
CONST String type=kotlin.String value='0'
|
||||
SPREAD_ELEMENT
|
||||
CALL .<get-test2> type=kotlin.Array<kotlin.String> operator=GET_PROPERTY
|
||||
SPREAD_ELEMENT
|
||||
CALL .<get-test1> type=kotlin.Array<kotlin.String> operator=GET_PROPERTY
|
||||
CONST String type=kotlin.String value='4'
|
||||
@@ -0,0 +1,9 @@
|
||||
fun testScalar(a: Any): IntArray {
|
||||
if (a !is Int) return intArrayOf()
|
||||
return intArrayOf(a)
|
||||
}
|
||||
|
||||
fun testSpread(a: Any): IntArray {
|
||||
if (a !is IntArray) return intArrayOf()
|
||||
return intArrayOf(*a)
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
FILE /varargWithImplicitCast.kt
|
||||
FUN public fun testScalar(/*0*/ a: kotlin.Any): kotlin.IntArray
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.Int
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
elements: VARARG type=IntArray varargElementType=Int
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Int
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
FUN public fun testSpread(/*0*/ a: kotlin.Any): kotlin.IntArray
|
||||
BLOCK_BODY
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=NOT_INSTANCEOF typeOperand=kotlin.IntArray
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
then: RETURN type=kotlin.Nothing
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .intArrayOf type=kotlin.IntArray operator=null
|
||||
elements: VARARG type=IntArray varargElementType=Int
|
||||
SPREAD_ELEMENT
|
||||
TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.IntArray
|
||||
GET_VAR a type=kotlin.Any operator=null
|
||||
@@ -0,0 +1,6 @@
|
||||
fun String.k(): () -> String = { -> this }
|
||||
|
||||
fun test1(f: () -> Unit) = f()
|
||||
fun test2(f: String.() -> Unit) = "hello".f()
|
||||
fun test3() = "hello".k()()
|
||||
fun test4(ns: String?) = ns?.k()?.invoke()
|
||||
@@ -0,0 +1,33 @@
|
||||
FILE /variableAsFunctionCall.kt
|
||||
FUN public fun kotlin.String.k(): () -> kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
DUMMY KtLambdaExpression type=() -> kotlin.String
|
||||
FUN public fun test1(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .invoke type=kotlin.Unit operator=INVOKE
|
||||
$this: GET_VAR f type=() -> kotlin.Unit operator=VARIABLE_AS_FUNCTION
|
||||
FUN public fun test2(/*0*/ f: kotlin.String.() -> kotlin.Unit): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .invoke type=kotlin.Unit operator=INVOKE
|
||||
$this: GET_VAR f type=kotlin.String.() -> kotlin.Unit operator=VARIABLE_AS_FUNCTION
|
||||
$receiver: CONST String type=kotlin.String value='hello'
|
||||
FUN public fun test3(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
CALL .invoke type=kotlin.String operator=null
|
||||
$this: CALL .k type=() -> kotlin.String operator=null
|
||||
$receiver: CONST String type=kotlin.String value='hello'
|
||||
FUN public fun test4(/*0*/ ns: kotlin.String?): kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.String? operator=SAFE_CALL
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR ns type=kotlin.String? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST Null type=kotlin.Nothing? value='null'
|
||||
else: CALL .invoke type=kotlin.String operator=null
|
||||
$this: CALL .k type=() -> kotlin.String operator=null
|
||||
$this: GET_VAR ns type=kotlin.String? operator=null
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
object A
|
||||
|
||||
fun testWithSubject(x: Any?) =
|
||||
when (x) {
|
||||
null -> "null"
|
||||
A -> "A"
|
||||
is String -> "String"
|
||||
in setOf<Nothing>() -> "nothingness?"
|
||||
else -> "something"
|
||||
}
|
||||
|
||||
fun test(x: Any?) =
|
||||
when {
|
||||
x == null -> "null"
|
||||
x == A -> "A"
|
||||
x is String -> "String"
|
||||
x in setOf<Nothing>() -> "nothingness?"
|
||||
else -> "something"
|
||||
}
|
||||
|
||||
fun testComma(x: Int) =
|
||||
when (x) {
|
||||
1, 2, 3, 4 -> "1234"
|
||||
5, 6, 7 -> "567"
|
||||
8, 9 -> "89"
|
||||
else -> "?"
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
FILE /when.kt
|
||||
CLASS OBJECT A
|
||||
FUN public fun testWithSubject(/*0*/ x: kotlin.Any?): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.String operator=WHEN
|
||||
VAR val tmp0_subject: kotlin.Any?
|
||||
GET_VAR x type=kotlin.Any? operator=null
|
||||
WHEN type=kotlin.String operator=WHEN
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST String type=kotlin.String value='null'
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||
arg1: GET_OBJECT A type=A
|
||||
then: CONST String type=kotlin.String value='A'
|
||||
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||
then: CONST String type=kotlin.String value='String'
|
||||
if: CALL .contains type=kotlin.Boolean operator=IN
|
||||
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
|
||||
element: GET_VAR tmp0_subject type=kotlin.Any? operator=null
|
||||
then: CONST String type=kotlin.String value='nothingness?'
|
||||
else: CONST String type=kotlin.String value='something'
|
||||
FUN public fun test(/*0*/ x: kotlin.Any?): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
WHEN type=kotlin.String operator=WHEN
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.Any? operator=null
|
||||
arg1: CONST Null type=kotlin.Nothing? value='null'
|
||||
then: CONST String type=kotlin.String value='null'
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR x type=kotlin.Any? operator=null
|
||||
arg1: GET_OBJECT A type=A
|
||||
then: CONST String type=kotlin.String value='A'
|
||||
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.String
|
||||
GET_VAR x type=kotlin.Any? operator=null
|
||||
then: CONST String type=kotlin.String value='String'
|
||||
if: CALL .contains type=kotlin.Boolean operator=IN
|
||||
$receiver: CALL .setOf type=kotlin.collections.Set<kotlin.Nothing> operator=null
|
||||
element: GET_VAR x type=kotlin.Any? operator=null
|
||||
then: CONST String type=kotlin.String value='nothingness?'
|
||||
else: CONST String type=kotlin.String value='something'
|
||||
FUN public fun testComma(/*0*/ x: kotlin.Int): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing
|
||||
BLOCK type=kotlin.String operator=WHEN
|
||||
VAR val tmp0_subject: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=null
|
||||
WHEN type=kotlin.String operator=WHEN
|
||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='1'
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='2'
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='3'
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='4'
|
||||
then: CONST String type=kotlin.String value='1234'
|
||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='5'
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='6'
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='7'
|
||||
then: CONST String type=kotlin.String value='567'
|
||||
if: WHEN type=kotlin.Boolean operator=WHEN_COMMA
|
||||
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='8'
|
||||
then: CONST Boolean type=kotlin.Boolean value='true'
|
||||
else: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||
arg0: GET_VAR tmp0_subject type=kotlin.Int operator=null
|
||||
arg1: CONST Int type=kotlin.Int value='9'
|
||||
then: CONST String type=kotlin.String value='89'
|
||||
else: CONST String type=kotlin.String value='?'
|
||||
@@ -0,0 +1,17 @@
|
||||
fun test() {
|
||||
var x = 0
|
||||
while (x < 0);
|
||||
while (x < 5) x++
|
||||
while (x < 10) { x++ }
|
||||
do while (x < 0)
|
||||
do x++ while (x < 15)
|
||||
do { x ++ } while (x < 20)
|
||||
}
|
||||
|
||||
fun testSmartcastInCondition() {
|
||||
val a: Any? = null
|
||||
if (a is Boolean) {
|
||||
while (a) {}
|
||||
do {} while (a)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
FILE /whileDoWhile.kt
|
||||
FUN public fun test(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR var x: kotlin.Int
|
||||
CONST Int type=kotlin.Int value='0'
|
||||
WHILE label=null operator=WHILE_LOOP
|
||||
condition: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='0'
|
||||
WHILE label=null operator=WHILE_LOOP
|
||||
condition: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='5'
|
||||
body: BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp0: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=POSTFIX_INCR
|
||||
SET_VAR x type=kotlin.Unit operator=POSTFIX_INCR
|
||||
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
GET_VAR tmp0 type=kotlin.Int operator=null
|
||||
WHILE label=null operator=WHILE_LOOP
|
||||
condition: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='10'
|
||||
body: BLOCK type=kotlin.Int operator=null
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp1: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=POSTFIX_INCR
|
||||
SET_VAR x type=kotlin.Unit operator=POSTFIX_INCR
|
||||
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
GET_VAR tmp1 type=kotlin.Int operator=null
|
||||
DO_WHILE label=null operator=DO_WHILE_LOOP
|
||||
condition: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='0'
|
||||
DO_WHILE label=null operator=DO_WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp2: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=POSTFIX_INCR
|
||||
SET_VAR x type=kotlin.Unit operator=POSTFIX_INCR
|
||||
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp2 type=kotlin.Int operator=null
|
||||
GET_VAR tmp2 type=kotlin.Int operator=null
|
||||
condition: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='15'
|
||||
DO_WHILE label=null operator=DO_WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit operator=null
|
||||
BLOCK type=kotlin.Int operator=POSTFIX_INCR
|
||||
VAR val tmp3: kotlin.Int
|
||||
GET_VAR x type=kotlin.Int operator=POSTFIX_INCR
|
||||
SET_VAR x type=kotlin.Unit operator=POSTFIX_INCR
|
||||
CALL .inc type=kotlin.Int operator=POSTFIX_INCR
|
||||
$this: GET_VAR tmp3 type=kotlin.Int operator=null
|
||||
GET_VAR tmp3 type=kotlin.Int operator=null
|
||||
condition: CALL .LT0 type=kotlin.Boolean operator=LT
|
||||
arg0: CALL .compareTo type=kotlin.Int operator=LT
|
||||
$this: GET_VAR x type=kotlin.Int operator=null
|
||||
other: CONST Int type=kotlin.Int value='20'
|
||||
FUN public fun testSmartcastInCondition(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR val a: kotlin.Any? = null
|
||||
CONST Null type=kotlin.Nothing? value='null'
|
||||
WHEN type=kotlin.Unit operator=IF
|
||||
if: TYPE_OP operator=INSTANCEOF typeOperand=kotlin.Boolean
|
||||
GET_VAR a type=kotlin.Any? operator=null
|
||||
then: BLOCK type=kotlin.Unit operator=null
|
||||
WHILE label=null operator=WHILE_LOOP
|
||||
condition: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR a type=kotlin.Any? operator=null
|
||||
body: BLOCK type=kotlin.Unit operator=null
|
||||
DO_WHILE label=null operator=DO_WHILE_LOOP
|
||||
body: BLOCK type=kotlin.Unit operator=null
|
||||
condition: TYPE_OP operator=IMPLICIT_CAST typeOperand=kotlin.Boolean
|
||||
GET_VAR a type=kotlin.Any? operator=null
|
||||
Reference in New Issue
Block a user