FIR: Refine visibility check for class members
This commit is contained in:
committed by
TeamCityServer
parent
d702365632
commit
fba44759c0
@@ -8,5 +8,5 @@ class IllegalVersion()
|
||||
@<!INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2")
|
||||
class LegalMinimum()
|
||||
|
||||
@<!INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2", versionKind = <!INVISIBLE_REFERENCE!>RequireKotlinVersionKind<!>.COMPILER_VERSION, message = "Requires newer compiler version to be inlined correctly.")
|
||||
@<!INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2", versionKind = <!INVISIBLE_REFERENCE!>RequireKotlinVersionKind<!>.<!INVISIBLE_REFERENCE!>COMPILER_VERSION<!>, message = "Requires newer compiler version to be inlined correctly.")
|
||||
class LegalStdLib()
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun test() {
|
||||
A.Companion.<!INVISIBLE_REFERENCE!>f<!>
|
||||
B.D
|
||||
CCC
|
||||
CCC.classObjectVar
|
||||
CCC.<!INVISIBLE_REFERENCE!>classObjectVar<!>
|
||||
}
|
||||
|
||||
class A() {
|
||||
|
||||
Vendored
+2
-2
@@ -3,7 +3,7 @@ package test
|
||||
fun use() {
|
||||
Default.create()
|
||||
|
||||
Explicit.create()
|
||||
Explicit.<!INVISIBLE_REFERENCE!>create<!>()
|
||||
}
|
||||
|
||||
private class Default {
|
||||
@@ -16,4 +16,4 @@ private class Explicit {
|
||||
private companion object {
|
||||
fun create() = Explicit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -40,12 +40,12 @@ fun test() {
|
||||
f(<!INVISIBLE_REFERENCE!>D<!>)
|
||||
|
||||
A.foo()
|
||||
<!INVISIBLE_REFERENCE!>B<!>.bar()
|
||||
C.baz()
|
||||
<!INVISIBLE_REFERENCE!>D<!>.quux()
|
||||
<!INVISIBLE_REFERENCE!>B<!>.<!INVISIBLE_REFERENCE!>bar<!>()
|
||||
C.<!INVISIBLE_REFERENCE!>baz<!>()
|
||||
<!INVISIBLE_REFERENCE!>D<!>.<!INVISIBLE_REFERENCE!>quux<!>()
|
||||
|
||||
a.A.foo()
|
||||
a.C.baz()
|
||||
a.C.<!INVISIBLE_REFERENCE!>baz<!>()
|
||||
}
|
||||
|
||||
fun f(unused: Any) {}
|
||||
|
||||
+1
-1
@@ -12,4 +12,4 @@ class A {
|
||||
|
||||
fun <!EXPOSED_FUNCTION_RETURN_TYPE!>f1<!>() = A.Companion.B.<!INVISIBLE_REFERENCE!>C<!>
|
||||
|
||||
fun f2() = A.Companion.B.<!INVISIBLE_REFERENCE!>C<!>.foo()
|
||||
fun f2() = A.Companion.B.<!INVISIBLE_REFERENCE!>C<!>.<!INVISIBLE_REFERENCE!>foo<!>()
|
||||
|
||||
@@ -31,7 +31,7 @@ private object TopLevelObject {
|
||||
fun testAccess() {
|
||||
<!INVISIBLE_REFERENCE!>NestedClass<!>()
|
||||
E1
|
||||
InNested()
|
||||
NestedEntry
|
||||
<!INVISIBLE_REFERENCE!>InNested<!>()
|
||||
<!INVISIBLE_REFERENCE!>NestedEntry<!>
|
||||
inObject()
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,5 +22,5 @@ import B.JC.JC1
|
||||
|
||||
fun test() {
|
||||
<!INVISIBLE_REFERENCE!>O1<!>
|
||||
JC1()
|
||||
<!INVISIBLE_REFERENCE!>JC1<!>()
|
||||
}
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ private enum class TopLevelEnum(private val e: NestedEnum) {
|
||||
|
||||
fun testAccess() {
|
||||
E1
|
||||
NestedEntry
|
||||
A1()
|
||||
<!INVISIBLE_REFERENCE!>NestedEntry<!>
|
||||
<!INVISIBLE_REFERENCE!>A1<!>()
|
||||
<!INVISIBLE_REFERENCE!>A2<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,5 +14,5 @@ public class Foo {
|
||||
// FILE: 1.kt
|
||||
|
||||
fun main() {
|
||||
javaPackage.Foo.<!INVISIBLE_REFERENCE!>Bar<!>.doSmth()
|
||||
javaPackage.Foo.<!INVISIBLE_REFERENCE!>Bar<!>.<!INVISIBLE_REFERENCE!>doSmth<!>()
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ package a
|
||||
|
||||
fun test() {
|
||||
val y = makeA()
|
||||
y.bar()
|
||||
y.<!INVISIBLE_REFERENCE!>bar<!>()
|
||||
<!INVISIBLE_REFERENCE!>foo<!>()
|
||||
|
||||
val u : A = <!INVISIBLE_REFERENCE!>A<!>()
|
||||
|
||||
@@ -24,7 +24,7 @@ import a.PO
|
||||
|
||||
fun test() {
|
||||
val y = makeA()
|
||||
y.bar()
|
||||
y.<!INVISIBLE_REFERENCE!>bar<!>()
|
||||
<!INVISIBLE_REFERENCE!>foo<!>()
|
||||
|
||||
val u : A = <!INVISIBLE_REFERENCE!>A<!>()
|
||||
|
||||
@@ -25,7 +25,7 @@ package a
|
||||
|
||||
fun test() {
|
||||
val y = makeA()
|
||||
y.bar()
|
||||
y.<!INVISIBLE_REFERENCE!>bar<!>()
|
||||
<!INVISIBLE_REFERENCE!>foo<!>()
|
||||
|
||||
val u : A = <!INVISIBLE_REFERENCE!>A<!>()
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ fun testSmartcast(x: Any) {
|
||||
|
||||
fun testInference(a: A, b: B) {
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("foo.PackagePrivateInterface")!>select(a, b)<!>
|
||||
x.foo()
|
||||
x.<!INVISIBLE_REFERENCE!>foo<!>()
|
||||
}
|
||||
|
||||
// FILE: samePackage.kt
|
||||
|
||||
+1
-1
@@ -39,5 +39,5 @@ fun testSmartcast(x: Any) {
|
||||
|
||||
fun testInference(a: A, b: B) {
|
||||
val x = <!DEBUG_INFO_EXPRESSION_TYPE("foo.PrivateInterface")!>select(a, b)<!>
|
||||
x.foo()
|
||||
x.<!INVISIBLE_REFERENCE!>foo<!>()
|
||||
}
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
// FILE: test/JavaBase.java
|
||||
package test;
|
||||
|
||||
abstract /* package-private */ class JavaBase {
|
||||
public void foo() {}
|
||||
}
|
||||
|
||||
// FILE: test/JavaBase2.java
|
||||
package test;
|
||||
public class JavaBase2 extends JavaBase {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import test.*
|
||||
|
||||
class KotlinClass : JavaBase2() {
|
||||
override fun foo() {}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// SKIP_TXT
|
||||
open class BaseWithPrivate {
|
||||
private companion object {
|
||||
val X: Int = 1
|
||||
val Y: Int = 1
|
||||
}
|
||||
}
|
||||
|
||||
open class Base {
|
||||
companion object {
|
||||
val X: String = ""
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun foo() {
|
||||
object : BaseWithPrivate() {
|
||||
fun bar() {
|
||||
X.length
|
||||
<!INVISIBLE_REFERENCE!>Y<!>.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// SKIP_TXT
|
||||
open class BaseWithPrivate {
|
||||
private companion object {
|
||||
val X: Int = 1
|
||||
val Y: Int = 1
|
||||
}
|
||||
}
|
||||
|
||||
open class Base {
|
||||
companion object {
|
||||
val X: String = ""
|
||||
}
|
||||
}
|
||||
|
||||
class Derived : Base() {
|
||||
fun foo() {
|
||||
object : BaseWithPrivate() {
|
||||
fun bar() {
|
||||
X.length
|
||||
<!INVISIBLE_MEMBER!>Y<!>.hashCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user