Decrease visibility fix is now active for exposed visibility errors #KT-11920 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-04-18 19:25:13 +03:00
committed by Mikhail Glukhikh
parent 934c374030
commit d5b9a336a3
23 changed files with 286 additions and 26 deletions

View File

@@ -0,0 +1,14 @@
// "Make foo private" "false"
// ACTION: Convert parameter to receiver
// ACTION: Make Nested internal
// ACTION: Remove parameter 'arg'
// ERROR: 'internal' function exposes its 'private' parameter type argument Nested
// ERROR: Cannot access 'Nested': it is 'private' in 'Outer'
class Outer {
private class Nested
}
class Generic<T>
internal fun foo(<caret>arg: Generic<Outer.Nested>) {}

View File

@@ -0,0 +1,7 @@
// "Make foo private" "true"
private data class Data(val x: Int)
class First {
val <caret>foo = Data(13)
}

View File

@@ -0,0 +1,7 @@
// "Make foo private" "true"
private data class Data(val x: Int)
class First {
private val foo = Data(13)
}

View File

@@ -0,0 +1,12 @@
// "Make foo private" "false"
// ACTION: Convert receiver to parameter
// ACTION: Make Private protected
// ERROR: 'protected (in My)' member exposes its 'private' receiver type argument Private
class Receiver<T>
abstract class My {
private class Private
// abstract never can be private
abstract protected fun <caret>Receiver<Private>.foo()
}

View File

@@ -0,0 +1,7 @@
// "Make bar private" "true"
private data class Data(val x: Int)
class First {
internal fun <caret>bar(x: Int) = Data(x)
}

View File

@@ -0,0 +1,7 @@
// "Make bar private" "true"
private data class Data(val x: Int)
class First {
private fun bar(x: Int) = Data(x)
}

View File

@@ -0,0 +1,7 @@
// "Make First private" "true"
class Outer {
private open class Data(val x: Int)
protected class First : <caret>Data(42)
}

View File

@@ -0,0 +1,7 @@
// "Make First private" "true"
class Outer {
private open class Data(val x: Int)
private class First : Data(42)
}

View File

@@ -0,0 +1,7 @@
// "Make First private" "true"
private open class Data(val x: Int)
class Outer {
protected class First : <caret>Data(42)
}

View File

@@ -0,0 +1,7 @@
// "Make First private" "true"
private open class Data(val x: Int)
class Outer {
private class First : Data(42)
}

View File

@@ -0,0 +1,9 @@
// "Make First private" "true"
class Other {
internal open class Data(val x: Int)
}
class Another {
protected class First : Other.<caret>Data(42)
}

View File

@@ -0,0 +1,9 @@
// "Make First private" "true"
class Other {
internal open class Data(val x: Int)
}
class Another {
private class First : Other.Data(42)
}

View File

@@ -0,0 +1,11 @@
// "Make Derived internal" "true"
import Outer.Base
internal class Outer {
interface Base
}
class Container {
interface Derived : <caret>Base
}

View File

@@ -0,0 +1,11 @@
// "Make Derived internal" "true"
import Outer.Base
internal class Outer {
interface Base
}
class Container {
internal interface Derived : Base
}

View File

@@ -0,0 +1,5 @@
// "Make User internal" "true"
internal open class InternalString
class User<T : <caret>User<T, InternalString>, R>

View File

@@ -0,0 +1,5 @@
// "Make User internal" "true"
internal open class InternalString
internal class User<T : User<T, InternalString>, R>