[K/N] Supported outer this references from cached inline bodies
This commit is contained in:
@@ -1416,6 +1416,24 @@ linkTest("innerClass_linkTest") {
|
||||
lib = "codegen/innerClass/linkTest_lib.kt"
|
||||
}
|
||||
|
||||
linkTest("innerClass_inheritance_linkTest") {
|
||||
useGoldenData = true
|
||||
source = "codegen/innerClass/inheritance_linkTest_main.kt"
|
||||
lib = "codegen/innerClass/inheritance_linkTest_lib.kt"
|
||||
}
|
||||
|
||||
linkTest("innerClass_inheritance2_linkTest") {
|
||||
useGoldenData = true
|
||||
source = "codegen/innerClass/inheritance2_linkTest_main.kt"
|
||||
lib = "codegen/innerClass/inheritance2_linkTest_lib.kt"
|
||||
}
|
||||
|
||||
linkTest("innerClass_inheritance3_linkTest") {
|
||||
useGoldenData = true
|
||||
source = "codegen/innerClass/inheritance3_linkTest_main.kt"
|
||||
lib = "codegen/innerClass/inheritance3_linkTest_lib.kt"
|
||||
}
|
||||
|
||||
task localClass_localHierarchy(type: KonanLocalTest) {
|
||||
useGoldenData = true
|
||||
source = "codegen/localClass/localHierarchy.kt"
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
open class Outer(val x: Int) {
|
||||
open inner class Inner1
|
||||
inner class Middle(x: Int) : Outer(x) {
|
||||
inner class Inner2 : Inner1() {
|
||||
fun foo() = this@Outer.x + this@Middle.x
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
val o = Outer(42).Middle(117).Inner2()
|
||||
println(o.foo())
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
159
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
open class Outer {
|
||||
open inner class Inner1
|
||||
inner class Middle {
|
||||
inner class Inner2 : Inner1() {
|
||||
fun getOuter() = this@Outer
|
||||
fun getMiddle() = this@Middle
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
fun main() {
|
||||
val o = Outer().Middle().Inner2()
|
||||
println(o.getOuter() != Outer())
|
||||
println(o.getMiddle() != Outer().Middle())
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
true
|
||||
true
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
open class Foo(val z: Int) {
|
||||
open inner class FooInner {
|
||||
fun foo() = z
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
class Bar : Foo(42) {
|
||||
inner class BarInner(val x: Int) : FooInner()
|
||||
}
|
||||
|
||||
fun main() {
|
||||
val o = Bar().BarInner(117)
|
||||
println(o.x)
|
||||
println(o.foo())
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
117
|
||||
42
|
||||
Reference in New Issue
Block a user