FIR: Support proper implicit return type computation for local classes

This commit is contained in:
Denis Zharkov
2020-03-20 16:43:16 +03:00
parent 94193c91a0
commit cdd7e41891
14 changed files with 377 additions and 38 deletions
@@ -0,0 +1,37 @@
fun useBoolean(b: Boolean) {}
fun main() {
class A {
fun foo(x: Int) = bar(x)
fun bar(y: Int) = this.hashCode() + y > 0
val w get() = z
val z get() = this.hashCode() == 0
}
val a = A()
useBoolean(a.foo(1))
useBoolean(a.bar(1))
useBoolean(a.w)
useBoolean(a.z)
class B {
fun foo(x: Int) = inner.w
fun bar(y: Int) = this.hashCode() + y > 0
val inner = Inner()
inner class Inner {
val w get() = z
val z get() = bar(1)
}
}
val b = B()
useBoolean(b.foo(1))
useBoolean(b.bar(1))
useBoolean(b.inner.w)
useBoolean(b.inner.z)
}