Move: Implement more accurate 'protected' visibility check

#KT-17545 Fixed
This commit is contained in:
Alexey Sedunov
2017-04-22 14:45:29 +03:00
parent 480982b690
commit a8c57f11af
10 changed files with 148 additions and 11 deletions
@@ -0,0 +1,8 @@
package bar
open class Older {
protected object ProtectedObject { val inProtectedObject = 0 }
protected class ProtectedClass { val inProtectedClass = 0 }
protected fun protectedFun() = 0
protected var protectedVar = 0
}
@@ -0,0 +1,12 @@
package foo
import bar.Older
class Younger : Older() {
protected val v1: ProtectedObject = ProtectedObject
val v2 = ProtectedObject.inProtectedObject
protected val v3: ProtectedClass = ProtectedClass()
val v4 = ProtectedClass().inProtectedClass
val v5 = protectedFun()
val v6 = protectedVar
}
@@ -0,0 +1,17 @@
package foo
open class <caret>Older {
protected object ProtectedObject { val inProtectedObject = 0 }
protected class ProtectedClass { val inProtectedClass = 0 }
protected fun protectedFun() = 0
protected var protectedVar = 0
}
class Younger : Older() {
protected val v1: ProtectedObject = ProtectedObject
val v2 = ProtectedObject.inProtectedObject
protected val v3: ProtectedClass = ProtectedClass()
val v4 = ProtectedClass().inProtectedClass
val v5 = protectedFun()
val v6 = protectedVar
}
@@ -0,0 +1,5 @@
{
"mainFile": "foo/test.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "bar"
}
@@ -0,0 +1,12 @@
package bar
import foo.Older
class Younger : Older() {
protected val v1: ProtectedObject = ProtectedObject
val v2 = ProtectedObject.inProtectedObject
protected val v3: ProtectedClass = ProtectedClass()
val v4 = ProtectedClass().inProtectedClass
val v5 = protectedFun()
val v6 = protectedVar
}
@@ -0,0 +1,9 @@
package foo
open class Older {
protected object ProtectedObject { val inProtectedObject = 0 }
protected class ProtectedClass { val inProtectedClass = 0 }
protected fun protectedFun() = 0
protected var protectedVar = 0
}
@@ -0,0 +1,17 @@
package foo
open class Older {
protected object ProtectedObject { val inProtectedObject = 0 }
protected class ProtectedClass { val inProtectedClass = 0 }
protected fun protectedFun() = 0
protected var protectedVar = 0
}
class <caret>Younger : Older() {
protected val v1: ProtectedObject = ProtectedObject
val v2 = ProtectedObject.inProtectedObject
protected val v3: ProtectedClass = ProtectedClass()
val v4 = ProtectedClass().inProtectedClass
val v5 = protectedFun()
val v6 = protectedVar
}
@@ -0,0 +1,5 @@
{
"mainFile": "foo/test.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetPackage": "bar"
}