[FIR] Report errors about invisible types from type resolution

This commit is contained in:
Dmitriy Novozhilov
2021-11-23 15:18:40 +03:00
committed by teamcityserver
parent f2c319c4ae
commit 8707be51c9
39 changed files with 217 additions and 122 deletions
@@ -2,11 +2,11 @@ package kotlin.io
import kotlin.internal.*
@<!INVISIBLE_REFERENCE!>RequireKotlin<!>(<!ILLEGAL_KOTLIN_VERSION_STRING_VALUE!>"1.x"<!>)
@<!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>RequireKotlin<!>(<!ILLEGAL_KOTLIN_VERSION_STRING_VALUE!>"1.x"<!>)
class IllegalVersion()
@<!INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2")
@<!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2")
class LegalMinimum()
@<!INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2", versionKind = <!INVISIBLE_REFERENCE!>RequireKotlinVersionKind<!>.<!INVISIBLE_REFERENCE!>COMPILER_VERSION<!>, message = "Requires newer compiler version to be inlined correctly.")
@<!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>RequireKotlin<!>("1.2", versionKind = <!INVISIBLE_REFERENCE!>RequireKotlinVersionKind<!>.<!INVISIBLE_REFERENCE!>COMPILER_VERSION<!>, message = "Requires newer compiler version to be inlined correctly.")
class LegalStdLib()
@@ -10,5 +10,5 @@ class Bar: Foo() {
protected fun foo(): Nested? = null
}
private fun foo(): Nested? = null
private fun bar(): p.Foo.Nested? = null
private fun foo(): <!INVISIBLE_REFERENCE!>Nested<!>? = null
private fun bar(): <!INVISIBLE_REFERENCE!>p.Foo.Nested<!>? = null
@@ -15,4 +15,4 @@ package p1
import p2.*
val x: X = X()
val <!EXPOSED_PROPERTY_TYPE!>y<!>: Y = <!INVISIBLE_REFERENCE!>Y<!>()
val <!EXPOSED_PROPERTY_TYPE!>y<!>: <!INVISIBLE_REFERENCE!>Y<!> = <!INVISIBLE_REFERENCE!>Y<!>()
@@ -8,4 +8,4 @@ package a
import pack1.*
private class X : <!INVISIBLE_REFERENCE!>SomeClass<!>()
private class X : <!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>SomeClass<!>()
@@ -11,4 +11,4 @@ package a
import pack1.SomeClass.*
private class X : <!EXPOSED_SUPER_CLASS, FINAL_SUPERTYPE, INVISIBLE_REFERENCE!>N<!>()
private class X : <!EXPOSED_SUPER_CLASS, FINAL_SUPERTYPE, INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>N<!>()
@@ -1,7 +1,7 @@
// !CHECK_TYPE
@kotlin.internal.<!INVISIBLE_REFERENCE!>InlineOnly<!>
@<!INVISIBLE_REFERENCE!>kotlin.internal.<!INVISIBLE_REFERENCE!>InlineOnly<!><!>
public inline fun <C, R> C.ifEmpty(f: () -> R): R where C : Collection<*>, C : R = if (isEmpty()) f() else this
public fun <T> listOf(t: T): List<T> = TODO()
@@ -25,8 +25,8 @@ package b
fun f() {
val c1: a.M.Inner
val c2: a.M.Nested
val c3: a.M.PrInner
val c4: a.M.PrNested
val c3: <!INVISIBLE_REFERENCE!>a.M.PrInner<!>
val c4: <!INVISIBLE_REFERENCE!>a.M.PrNested<!>
}
@@ -15,5 +15,5 @@ class Bar : Foo() {
protected fun foo(): Nested? = null
}
private fun foo(): Nested? = null
private fun bar(): p.Foo.Nested? = null
private fun foo(): <!INVISIBLE_REFERENCE!>Nested<!>? = null
private fun bar(): <!INVISIBLE_REFERENCE!>p.Foo.Nested<!>? = null
@@ -11,9 +11,9 @@ package a
import p.Foo
import p.Foo.Nested
class Bar : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE!>Foo<!>() {
protected fun <!EXPOSED_FUNCTION_RETURN_TYPE!>foo<!>(): Nested? = null
class Bar : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>Foo<!>() {
protected fun <!EXPOSED_FUNCTION_RETURN_TYPE!>foo<!>(): <!INVISIBLE_REFERENCE!>Nested<!>? = null
}
private fun foo(): Nested? = null
private fun bar(): p.Foo.Nested? = null
private fun foo(): <!INVISIBLE_REFERENCE!>Nested<!>? = null
private fun bar(): <!INVISIBLE_REFERENCE!>p.Foo.Nested<!>? = null
@@ -17,11 +17,11 @@ class C1
// FILE: 2.kt
package pp
@<!INVISIBLE_REFERENCE!>A<!>(<!INVISIBLE_REFERENCE!>foo<!>)
@<!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>A<!>(<!INVISIBLE_REFERENCE!>foo<!>)
fun f2() {}
@<!INVISIBLE_REFERENCE!>A<!>(<!INVISIBLE_REFERENCE!>foo<!>)
@<!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>A<!>(<!INVISIBLE_REFERENCE!>foo<!>)
val p2 = ""
@<!INVISIBLE_REFERENCE!>A<!>(<!INVISIBLE_REFERENCE!>foo<!>)
@<!INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>A<!>(<!INVISIBLE_REFERENCE!>foo<!>)
class C2
@@ -32,7 +32,7 @@ fun test() {
y.<!INVISIBLE_REFERENCE!>bar<!>()
<!INVISIBLE_REFERENCE!>foo<!>()
val u : A = <!INVISIBLE_REFERENCE!>A<!>()
val u : <!INVISIBLE_REFERENCE!>A<!> = <!INVISIBLE_REFERENCE!>A<!>()
val z = <!INVISIBLE_REFERENCE!>x<!>
<!INVISIBLE_REFERENCE!>x<!> = 30
@@ -43,7 +43,7 @@ fun test() {
<!INVISIBLE_SETTER("xx; private; file")!>xx<!> = 40
}
class B : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE!>A<!>() {}
class B : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>A<!>() {}
class Q {
class W {
@@ -29,13 +29,13 @@ fun test() {
y.<!INVISIBLE_REFERENCE!>bar<!>()
<!INVISIBLE_REFERENCE!>foo<!>()
val u : A = <!INVISIBLE_REFERENCE!>A<!>()
val a : java.util.Arrays.ArrayList<Int>;
val u : <!INVISIBLE_REFERENCE!>A<!> = <!INVISIBLE_REFERENCE!>A<!>()
val a : <!INVISIBLE_REFERENCE!>java.util.Arrays.ArrayList<Int><!>;
val po = <!INVISIBLE_REFERENCE!>PO<!>
}
class B : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE!>A<!>() {}
class B : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>A<!>() {}
class Q {
class W {
@@ -28,7 +28,7 @@ fun test() {
y.<!INVISIBLE_REFERENCE!>bar<!>()
<!INVISIBLE_REFERENCE!>foo<!>()
val u : A = <!INVISIBLE_REFERENCE!>A<!>()
val u : <!INVISIBLE_REFERENCE!>A<!> = <!INVISIBLE_REFERENCE!>A<!>()
val z = <!INVISIBLE_REFERENCE!>x<!>
<!INVISIBLE_REFERENCE!>x<!> = 30
@@ -36,7 +36,7 @@ fun test() {
val po = <!INVISIBLE_REFERENCE!>PO<!>
}
class B : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE!>A<!>() {}
class B : <!EXPOSED_SUPER_CLASS, INVISIBLE_REFERENCE, INVISIBLE_REFERENCE!>A<!>() {}
class Q {
class W {
@@ -30,5 +30,5 @@ fun baz() {
a.A3("") checkType { _<String>() }
val x: a.A2 = B("") // A2 is unresolved because it's private in file, OK
val x: <!INVISIBLE_REFERENCE!>a.A2<!> = B("") // A2 is unresolved because it's private in file, OK
}
@@ -4,12 +4,12 @@ private class C {
companion object
}
private typealias TA = C
private typealias TA = <!INVISIBLE_REFERENCE!>C<!>
private val test1: C = <!INVISIBLE_REFERENCE!>C<!>()
private val test1co: C.Companion = <!INITIALIZER_TYPE_MISMATCH, INVISIBLE_REFERENCE, NO_COMPANION_OBJECT!>C<!>
private val test1: <!INVISIBLE_REFERENCE!>C<!> = <!INVISIBLE_REFERENCE!>C<!>()
private val test1co: <!INVISIBLE_REFERENCE!>C.Companion<!> = <!INITIALIZER_TYPE_MISMATCH, INVISIBLE_REFERENCE, NO_COMPANION_OBJECT!>C<!>
private val test2: TA = <!INITIALIZER_TYPE_MISMATCH!>TA(<!NO_VALUE_FOR_PARAMETER!>)<!><!>
private val test2: <!INVISIBLE_REFERENCE!>TA<!> = <!INITIALIZER_TYPE_MISMATCH!>TA(<!NO_VALUE_FOR_PARAMETER!>)<!><!>
private val test2co = <!INVISIBLE_REFERENCE!>TA<!>
// FILE: file2.kt
@@ -0,0 +1,13 @@
// FILE: 1.kt
private class Private {
class Public
}
// FILE: 2.kt
import Private.Public
private fun test_1(x: <!INVISIBLE_REFERENCE!>Private.Public<!>, y: <!INVISIBLE_REFERENCE!>Public<!>) {
}
@@ -0,0 +1,13 @@
// FILE: 1.kt
private class Private {
class Public
}
// FILE: 2.kt
import <!INVISIBLE_REFERENCE!>Private<!>.Public
private fun test_1(x: <!INVISIBLE_REFERENCE!>Private<!>.<!INVISIBLE_REFERENCE!>Public<!>, y: <!INVISIBLE_REFERENCE!>Public<!>) {
}
@@ -0,0 +1,17 @@
package
private fun test_1(/*0*/ x: Private.Public, /*1*/ y: Private.Public): kotlin.Unit
private final class Private {
public constructor Private()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Public {
public constructor Public()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}