[AllOpen] Private properties can be considered stable even when open
The AllOpen plugin can make private members open. But for private properties, they can be considered stable for smart-casting if they do not have a custom getter. #KT-58049 Fixed
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
annotation class AllOpen
|
||||
|
||||
@AllOpen
|
||||
annotation class ConsoleCommands(
|
||||
val <!NON_FINAL_MEMBER_IN_FINAL_CLASS!>value<!>: String = "",
|
||||
val <!NON_FINAL_MEMBER_IN_FINAL_CLASS!>scope<!>: String
|
||||
)
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
|
||||
annotation class AllOpen
|
||||
|
||||
@AllOpen
|
||||
annotation class ConsoleCommands(
|
||||
val <!NON_FINAL_MEMBER_IN_FINAL_CLASS!>value<!>: String = "",
|
||||
val <!NON_FINAL_MEMBER_IN_FINAL_CLASS!>scope<!>: String
|
||||
val value: String = "",
|
||||
val scope: String
|
||||
)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-58049
|
||||
|
||||
annotation class AllOpen
|
||||
|
||||
@AllOpen
|
||||
class Test(
|
||||
val publicProp: String?,
|
||||
protected val protectedProp: String?,
|
||||
internal val internalProp: String?,
|
||||
private val privateProp: String?,
|
||||
) {
|
||||
fun test() {
|
||||
checkNotNull(publicProp)
|
||||
checkNotNull(protectedProp)
|
||||
checkNotNull(internalProp)
|
||||
checkNotNull(privateProp)
|
||||
|
||||
println(<!SMARTCAST_IMPOSSIBLE!>publicProp<!>.length)
|
||||
println(<!SMARTCAST_IMPOSSIBLE!>protectedProp<!>.length)
|
||||
println(<!SMARTCAST_IMPOSSIBLE!>internalProp<!>.length)
|
||||
println(privateProp.length)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-58049
|
||||
|
||||
annotation class AllOpen
|
||||
|
||||
@AllOpen
|
||||
class Test(
|
||||
val publicProp: String?,
|
||||
protected val protectedProp: String?,
|
||||
internal val internalProp: String?,
|
||||
private val privateProp: String?,
|
||||
) {
|
||||
fun test() {
|
||||
checkNotNull(publicProp)
|
||||
checkNotNull(protectedProp)
|
||||
checkNotNull(internalProp)
|
||||
checkNotNull(privateProp)
|
||||
|
||||
println(<!SMARTCAST_IMPOSSIBLE!>publicProp<!>.length)
|
||||
println(<!SMARTCAST_IMPOSSIBLE!>protectedProp<!>.length)
|
||||
println(<!SMARTCAST_IMPOSSIBLE!>internalProp<!>.length)
|
||||
println(<!DEBUG_INFO_SMARTCAST!>privateProp<!>.length)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user