Add test for outer class instance reference from inner class

This commit is contained in:
Dmitry Petrov
2017-04-21 14:37:01 +03:00
parent 5ec9cb3171
commit aa515a9e5a
3 changed files with 42 additions and 0 deletions
@@ -0,0 +1,7 @@
class Outer {
fun outer() {}
inner class Inner {
fun inner() = outer()
}
}
@@ -0,0 +1,29 @@
FILE /outerClassInstanceReference.kt
CLASS CLASS Outer
$new: VALUE_PARAMETER this@Outer: Outer
CONSTRUCTOR public constructor Outer()
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
INSTANCE_INITIALIZER_CALL classDescriptor='Outer'
FUN public final fun outer(): kotlin.Unit
$this: VALUE_PARAMETER this@Outer: Outer
BLOCK_BODY
CLASS CLASS Inner
$new: VALUE_PARAMETER this@Inner: Inner
CONSTRUCTOR public constructor Inner()
$outer: VALUE_PARAMETER this@Outer: Outer
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'constructor Any()'
INSTANCE_INITIALIZER_CALL classDescriptor='Inner'
FUN public final fun inner(): kotlin.Unit
$this: VALUE_PARAMETER this@Inner: Inner
BLOCK_BODY
RETURN type=kotlin.Nothing from='inner(): Unit'
CALL 'outer(): Unit' type=kotlin.Unit origin=null
$this: GET_VAR 'this@Outer: Outer' type=Outer origin=null
FUN FAKE_OVERRIDE public open override fun equals(other: kotlin.Any?): kotlin.Boolean
FUN FAKE_OVERRIDE public open override fun hashCode(): kotlin.Int
FUN FAKE_OVERRIDE public open override fun toString(): kotlin.String
FUN FAKE_OVERRIDE public open override fun equals(other: kotlin.Any?): kotlin.Boolean
FUN FAKE_OVERRIDE public open override fun hashCode(): kotlin.Int
FUN FAKE_OVERRIDE public open override fun toString(): kotlin.String
@@ -737,6 +737,12 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase {
doTest(fileName);
}
@TestMetadata("outerClassInstanceReference.kt")
public void testOuterClassInstanceReference() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt");
doTest(fileName);
}
@TestMetadata("primitiveComparisons.kt")
public void testPrimitiveComparisons() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/ir/irText/expressions/primitiveComparisons.kt");