FIR: bail out early for override check if base candidate is private

This commit is contained in:
Jinseong Jeon
2021-02-12 16:12:21 -08:00
committed by Mikhail Glukhikh
parent 09640d9d63
commit a884555171
4 changed files with 20 additions and 6 deletions
@@ -1,10 +1,11 @@
class A(
private val x: String,
private var y: Double
open class A(
private val x: String,
private var y: Double
) {
fun foo() {
val r = {
if (x != "abc") throw AssertionError("$x")
if (y < 0.0) throw AssertionError("$y < 0.0")
y = 0.0
if (y != 0.0) throw AssertionError("$y")
}
@@ -12,7 +13,14 @@ class A(
}
}
class B(
val x: String,
y: Double
) : A("abc", y)
fun box(): String {
A("abc", 3.14).foo()
return "OK"
val b = B("OK", 0.42)
b.foo()
return b.x
}