K1: add use-site diagnostic about property shadowing by a field
Related to KT-50082
This commit is contained in:
committed by
teamcity
parent
59bafedd8a
commit
6234da4c86
+48
@@ -0,0 +1,48 @@
|
||||
// WITH_STDLIB
|
||||
// FILE: Base.java
|
||||
|
||||
public class Base {
|
||||
public String regular = "a";
|
||||
|
||||
public String withGetter = "b";
|
||||
|
||||
public String lateInit = "c";
|
||||
|
||||
public String lazyProp = "d";
|
||||
|
||||
public String withSetter = "e";
|
||||
|
||||
public String openProp = "f";
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
open class Derived : Base() {
|
||||
val regular = "aa"
|
||||
|
||||
val withGetter get() = "bb"
|
||||
|
||||
lateinit var lateInit: String
|
||||
|
||||
val lazyProp by lazy { "dd" }
|
||||
|
||||
var withSetter: String = "ee"
|
||||
set(value) {
|
||||
println(value)
|
||||
field = value
|
||||
}
|
||||
|
||||
open val openProp = "ff"
|
||||
}
|
||||
|
||||
fun test(d: Derived) {
|
||||
d.regular
|
||||
d.withGetter
|
||||
d.lateInit
|
||||
d.lazyProp
|
||||
d.withSetter = ""
|
||||
d.openProp
|
||||
|
||||
d::withGetter
|
||||
Derived::withGetter
|
||||
}
|
||||
Reference in New Issue
Block a user