Some more tests.
This commit is contained in:
committed by
Dmitry Petrov
parent
42988383e0
commit
f2e778d2d0
@@ -0,0 +1,9 @@
|
|||||||
|
abstract class Base
|
||||||
|
|
||||||
|
object Test : Base() {
|
||||||
|
val x = 1
|
||||||
|
val y: Int
|
||||||
|
init {
|
||||||
|
y = x
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
FILE /objectWithInitializers.kt
|
||||||
|
CLASS CLASS Base
|
||||||
|
CONSTRUCTOR public constructor Base()
|
||||||
|
BLOCK_BODY
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor=Base
|
||||||
|
CLASS OBJECT Test
|
||||||
|
CONSTRUCTOR private constructor Test()
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL .<init> type=Base operator=SUPER_CONSTRUCTOR_CALL
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor=Test
|
||||||
|
PROPERTY public final val x: kotlin.Int = 1
|
||||||
|
EXPRESSION_BODY
|
||||||
|
CONST Int type=kotlin.Int value='1'
|
||||||
|
PROPERTY public final val y: kotlin.Int
|
||||||
|
ANONYMOUS_INITIALIZER Test
|
||||||
|
BLOCK_BODY
|
||||||
|
SET_BACKING_FIELD y type=kotlin.Unit operator=null
|
||||||
|
CALL .<get-x> type=kotlin.Int operator=GET_PROPERTY
|
||||||
|
$this: THIS public object Test : Base type=Test
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
sealed class Expr {
|
||||||
|
class Const(val number: Double) : Expr()
|
||||||
|
class Sum(val e1: Expr, val e2: Expr) : Expr()
|
||||||
|
object NotANumber : Expr()
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
FILE /sealedClasses.kt
|
||||||
|
CLASS CLASS Expr
|
||||||
|
CONSTRUCTOR private constructor Expr()
|
||||||
|
BLOCK_BODY
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor=Expr
|
||||||
|
CLASS CLASS Const
|
||||||
|
CONSTRUCTOR public constructor Const(/*0*/ number: kotlin.Double)
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL .<init> type=Expr operator=SUPER_CONSTRUCTOR_CALL
|
||||||
|
SET_BACKING_FIELD number type=kotlin.Unit operator=null
|
||||||
|
GET_VAR number type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor=Const
|
||||||
|
PROPERTY public final val number: kotlin.Double
|
||||||
|
EXPRESSION_BODY
|
||||||
|
GET_VAR number type=kotlin.Double operator=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
CLASS CLASS Sum
|
||||||
|
CONSTRUCTOR public constructor Sum(/*0*/ e1: Expr, /*1*/ e2: Expr)
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL .<init> type=Expr operator=SUPER_CONSTRUCTOR_CALL
|
||||||
|
SET_BACKING_FIELD e1 type=kotlin.Unit operator=null
|
||||||
|
GET_VAR e1 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
SET_BACKING_FIELD e2 type=kotlin.Unit operator=null
|
||||||
|
GET_VAR e2 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor=Sum
|
||||||
|
PROPERTY public final val e1: Expr
|
||||||
|
EXPRESSION_BODY
|
||||||
|
GET_VAR e1 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
PROPERTY public final val e2: Expr
|
||||||
|
EXPRESSION_BODY
|
||||||
|
GET_VAR e2 type=Expr operator=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||||
|
CLASS OBJECT NotANumber
|
||||||
|
CONSTRUCTOR private constructor NotANumber()
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL .<init> type=Expr operator=SUPER_CONSTRUCTOR_CALL
|
||||||
|
INSTANCE_INITIALIZER_CALL classDescriptor=NotANumber
|
||||||
@@ -16,3 +16,16 @@ fun test2() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun testLrmFoo1(ints: List<Int>) {
|
||||||
|
ints.forEach lit@ {
|
||||||
|
if (it == 0) return@lit
|
||||||
|
print(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun testLrmFoo2(ints: List<Int>) {
|
||||||
|
ints.forEach {
|
||||||
|
if (it == 0) return@forEach
|
||||||
|
print(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,3 +23,35 @@ FILE /nonLocalReturn.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
RETURN type=kotlin.Nothing from=<anonymous>
|
RETURN type=kotlin.Nothing from=<anonymous>
|
||||||
CALLABLE_REFERENCE local final fun <anonymous>(): kotlin.Unit type=() -> kotlin.Unit
|
CALLABLE_REFERENCE local final fun <anonymous>(): kotlin.Unit type=() -> kotlin.Unit
|
||||||
|
FUN public fun testLrmFoo1(/*0*/ ints: kotlin.collections.List<kotlin.Int>): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL .forEach type=kotlin.Unit operator=null
|
||||||
|
$receiver: GET_VAR ints type=kotlin.collections.List<kotlin.Int> operator=null
|
||||||
|
action: BLOCK type=(kotlin.Int) -> kotlin.Unit operator=LAMBDA
|
||||||
|
FUN local final fun <anonymous>(/*0*/ it: kotlin.Int): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
WHEN type=kotlin.Unit operator=IF
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
|
arg0: GET_VAR it type=kotlin.Int operator=null
|
||||||
|
arg1: CONST Int type=kotlin.Int value='0'
|
||||||
|
then: RETURN type=kotlin.Nothing from=<anonymous>
|
||||||
|
RETURN type=kotlin.Nothing from=<anonymous>
|
||||||
|
CALL .print type=kotlin.Unit operator=null
|
||||||
|
message: GET_VAR it type=kotlin.Int operator=null
|
||||||
|
CALLABLE_REFERENCE local final fun <anonymous>(/*0*/ it: kotlin.Int): kotlin.Unit type=(kotlin.Int) -> kotlin.Unit
|
||||||
|
FUN public fun testLrmFoo2(/*0*/ ints: kotlin.collections.List<kotlin.Int>): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
CALL .forEach type=kotlin.Unit operator=null
|
||||||
|
$receiver: GET_VAR ints type=kotlin.collections.List<kotlin.Int> operator=null
|
||||||
|
action: BLOCK type=(kotlin.Int) -> kotlin.Unit operator=LAMBDA
|
||||||
|
FUN local final fun <anonymous>(/*0*/ it: kotlin.Int): kotlin.Unit
|
||||||
|
BLOCK_BODY
|
||||||
|
WHEN type=kotlin.Unit operator=IF
|
||||||
|
if: CALL .EQEQ type=kotlin.Boolean operator=EQEQ
|
||||||
|
arg0: GET_VAR it type=kotlin.Int operator=null
|
||||||
|
arg1: CONST Int type=kotlin.Int value='0'
|
||||||
|
then: RETURN type=kotlin.Nothing from=<anonymous>
|
||||||
|
RETURN type=kotlin.Nothing from=<anonymous>
|
||||||
|
CALL .print type=kotlin.Unit operator=null
|
||||||
|
message: GET_VAR it type=kotlin.Int operator=null
|
||||||
|
CALLABLE_REFERENCE local final fun <anonymous>(/*0*/ it: kotlin.Int): kotlin.Unit type=(kotlin.Int) -> kotlin.Unit
|
||||||
|
|||||||
@@ -127,6 +127,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("objectWithInitializers.kt")
|
||||||
|
public void testObjectWithInitializers() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/objectWithInitializers.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("primaryConstructor.kt")
|
@TestMetadata("primaryConstructor.kt")
|
||||||
public void testPrimaryConstructor() throws Exception {
|
public void testPrimaryConstructor() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/primaryConstructor.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/primaryConstructor.kt");
|
||||||
@@ -145,6 +151,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("sealedClasses.kt")
|
||||||
|
public void testSealedClasses() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/sealedClasses.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("secondaryConstructorWithInitializersFromClassBody.kt")
|
@TestMetadata("secondaryConstructorWithInitializersFromClassBody.kt")
|
||||||
public void testSecondaryConstructorWithInitializersFromClassBody() throws Exception {
|
public void testSecondaryConstructorWithInitializersFromClassBody() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/classes/secondaryConstructorWithInitializersFromClassBody.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user