Move: More accurate visibility analysis

#KT-10553 Fixed
This commit is contained in:
Alexey Sedunov
2016-01-20 18:26:53 +03:00
parent 64f6c62d4f
commit 218dd41a08
49 changed files with 442 additions and 112 deletions
@@ -0,0 +1,9 @@
class A {
private class B {
private class D
private class C {
private val d = D()
}
}
}
@@ -0,0 +1,9 @@
class A {
private class B {
private class D
private class <caret>C {
private val d = D()
}
}
}
@@ -0,0 +1 @@
Class C uses class D which will be inaccessible after move
@@ -0,0 +1,6 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_NESTED_CLASS",
"targetClass": "A",
"withRuntime": "true"
}
@@ -0,0 +1,13 @@
class A {
open class B {
protected class D
protected class C {
private val d = D()
}
}
}
class X : A.B() {
private val c = A.B.C()
}
@@ -0,0 +1,13 @@
class A {
open class B {
protected class D
protected class <caret>C {
private val d = D()
}
}
}
class X : A.B() {
private val c = A.B.C()
}
@@ -0,0 +1,2 @@
Class C uses class D which will be inaccessible after move
Property c uses class C which will be inaccessible after move
@@ -0,0 +1,6 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_NESTED_CLASS",
"targetClass": "A",
"withRuntime": "true"
}
@@ -0,0 +1,9 @@
class A {
private val a = B()
private class B {
private val c = C()
}
private class C()
}
@@ -0,0 +1,9 @@
class A {
private val a = B()
private class <caret>B {
private val c = C()
}
private class C()
}
@@ -0,0 +1,2 @@
Class B uses constructor C() which will be inaccessible after move
Property a uses class B which will be inaccessible after move
@@ -0,0 +1,5 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_NESTED_CLASS",
"withRuntime": "true"
}
@@ -0,0 +1,13 @@
open class A {
private val a = B()
protected class B {
private val c = C()
}
protected class C()
}
class X : A() {
private val b = B()
}
@@ -0,0 +1,13 @@
open class A {
private val a = B()
protected class <caret>B {
private val c = C()
}
protected class C()
}
class X : A() {
private val b = B()
}
@@ -0,0 +1 @@
Class B uses constructor C() which will be inaccessible after move
@@ -0,0 +1,5 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_NESTED_CLASS",
"withRuntime": "true"
}
@@ -0,0 +1,3 @@
class B {
private val c = A.C()
}
@@ -0,0 +1,9 @@
open class A {
private val a = B()
class C()
}
class X : A() {
private val b = B()
}
@@ -0,0 +1,13 @@
open class A {
private val a = B()
protected class <caret>B {
private val c = C()
}
class C()
}
class X : A() {
private val b = B()
}
@@ -0,0 +1,5 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_NESTED_CLASS",
"withRuntime": "true"
}
@@ -1,4 +1,4 @@
Class a.Test uses package-private class a.Foo
Class a.Test uses package-private function a.foo
Package-private class a.Test will no longer be accessible from method J.bar()
Package-private class a.Test will no longer be accessible from variable a.bar.t
Class Test uses class Foo which will be inaccessible after move
Class Test uses function foo() which will be inaccessible after move
Method bar() uses class Test which will be inaccessible after move
Variable t uses class Test which will be inaccessible after move
@@ -1,4 +1,4 @@
Function a.test uses package-private class a.Foo
Function a.test uses package-private function a.foo
Package-private function a.test will no longer be accessible from function a.bar
Package-private function a.test will no longer be accessible from method J.bar()
Function bar() uses function test() which will be inaccessible after move
Function test() uses class Foo which will be inaccessible after move
Function test() uses function foo() which will be inaccessible after move
Method bar() uses function test() which will be inaccessible after move
@@ -1,4 +1,4 @@
Object a.Test uses package-private class a.Foo
Object a.Test uses package-private function a.foo
Package-private object a.Test will no longer be accessible from method J.bar()
Package-private object a.Test will no longer be accessible from variable a.bar.t
Method bar() uses object Test which will be inaccessible after move
Object Test uses class Foo which will be inaccessible after move
Object Test uses function foo() which will be inaccessible after move
Variable t uses object Test which will be inaccessible after move
@@ -0,0 +1,9 @@
package a
private fun foo() {
bar()
}
private fun bar() {
foo()
}
@@ -0,0 +1,3 @@
package a
object Utils
@@ -0,0 +1,9 @@
package a
private fun <caret>foo() {
bar()
}
private fun bar() {
foo()
}
@@ -0,0 +1,3 @@
package a
object Utils
@@ -0,0 +1,2 @@
Function bar() uses function foo() which will be inaccessible after move
Function foo() uses function bar() which will be inaccessible after move
@@ -0,0 +1,5 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetFile": "utils.kt"
}
@@ -0,0 +1,7 @@
package a
private val foo: Int
get() = bar
private val bar: Int
get() = foo
@@ -0,0 +1,3 @@
package a
object Utils
@@ -0,0 +1,7 @@
package a
private val <caret>foo: Int
get() = bar
private val bar: Int
get() = foo
@@ -0,0 +1,3 @@
package a
object Utils
@@ -0,0 +1,2 @@
Property bar uses property foo which will be inaccessible after move
Property foo uses property bar which will be inaccessible after move
@@ -0,0 +1,5 @@
{
"mainFile": "main.kt",
"type": "MOVE_KOTLIN_TOP_LEVEL_DECLARATIONS",
"targetFile": "utils.kt"
}
@@ -1,4 +1,4 @@
Package-private property a.test will no longer be accessible from function a.bar
Package-private property a.test will no longer be accessible from method J.bar()
Property a.test uses package-private class a.Foo
Property a.test uses package-private function a.foo
Function bar() uses property test which will be inaccessible after move
Method bar() uses property test which will be inaccessible after move
Property test uses class Foo which will be inaccessible after move
Property test uses function foo() which will be inaccessible after move