From aa515a9e5a15fabb46d3b91be289b7b7ee90ad35 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Fri, 21 Apr 2017 14:37:01 +0300 Subject: [PATCH] Add test for outer class instance reference from inner class --- .../outerClassInstanceReference.kt | 7 +++++ .../outerClassInstanceReference.txt | 29 +++++++++++++++++++ .../kotlin/ir/IrTextTestCaseGenerated.java | 6 ++++ 3 files changed, 42 insertions(+) create mode 100644 compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt create mode 100644 compiler/testData/ir/irText/expressions/outerClassInstanceReference.txt diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt new file mode 100644 index 00000000000..0365f7d9bd0 --- /dev/null +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.kt @@ -0,0 +1,7 @@ +class Outer { + fun outer() {} + + inner class Inner { + fun inner() = outer() + } +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/expressions/outerClassInstanceReference.txt b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.txt new file mode 100644 index 00000000000..f12786f218e --- /dev/null +++ b/compiler/testData/ir/irText/expressions/outerClassInstanceReference.txt @@ -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 diff --git a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index c010e3f9105..83a0935a27c 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -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");