[FIR] Transform annotations of type refs in body resolve stage
Also fix building CFG for annotation calls
This commit is contained in:
committed by
TeamCityServer
parent
aec13defc4
commit
1f0ecade34
@@ -4,10 +4,10 @@
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class Anno(val value: String)
|
||||
|
||||
fun foo(x: String): @Anno(Lorem, ipsum::class, "dolor", sit-amet) String { // OK
|
||||
fun foo(x: String): @Anno(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>Lorem<!>, <!TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS!><!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>ipsum<!>::class<!>, <!TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS!>"dolor"<!>, <!TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS!><!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>sit<!>-<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>amet<!><!>) String { // OK
|
||||
return x
|
||||
}
|
||||
|
||||
abstract class Foo : @Anno(o_O) Throwable() // OK
|
||||
abstract class Foo : @Anno(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>o_O<!>) Throwable() // OK
|
||||
|
||||
abstract class Bar<T : @Anno(O_o) Any> // OK
|
||||
abstract class Bar<T : @Anno(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>O_o<!>) Any> // OK
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ interface B : A
|
||||
interface C : A
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> select(x: K, y: K): @kotlin.internal.Exact K = x
|
||||
fun <K> select(x: K, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = x
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ interface B : A
|
||||
interface C : A
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> select(x: K, y: K): @kotlin.internal.Exact K = x
|
||||
fun <K> select(x: K, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = x
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ interface ISample
|
||||
fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
fun <K> elvisExact(x: K?, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = TODO()
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ interface ISample
|
||||
fun <K> elvisSimple(x: K?, y: K): K = y
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <K> elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y
|
||||
fun <K> elvisExact(x: K?, y: K): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> K = y
|
||||
|
||||
fun <T : Number> materialize(): T? = null
|
||||
fun <T> Any?.materialize(): T = null as T
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import kotlin.internal.Exact
|
||||
|
||||
class Inv<I>(val arg: I)
|
||||
class InvExact<E>(val arg: @kotlin.internal.Exact E)
|
||||
class InvExact<E>(val arg: <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> E)
|
||||
|
||||
interface Base
|
||||
class Derived : Base
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
public class Foo {
|
||||
public static <K, V> void create(java.util.Map<? extends K, ? extends V> m) { return null; }
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
fun test(properties: Map<String, String>, nullableProperties: Map<String, String>?) {
|
||||
val f1 = Foo.create(select1(properties, myEmptyMap()))
|
||||
val f2 = Foo.create(nullableProperties ?: myEmptyMap())
|
||||
}
|
||||
|
||||
fun <T, R> myEmptyMap(): Map<T, R> = TODO()
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <S> select1(x: S, y: S): <!HIDDEN, HIDDEN!>@kotlin.internal.Exact<!> S = y
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
@@ -18,4 +17,4 @@ fun test(properties: Map<String, String>, nullableProperties: Map<String, String
|
||||
fun <T, R> myEmptyMap(): Map<T, R> = TODO()
|
||||
|
||||
@Suppress("INVISIBLE_REFERENCE")
|
||||
fun <S> select1(x: S, y: S): @kotlin.internal.Exact S = y
|
||||
fun <S> select1(x: S, y: S): @kotlin.internal.Exact S = y
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <R> Iterable<*>.filterIsInstance1(): List<@kotlin.internal.NoInfer R> = throw Exception()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <R> List<*>.filterIsInstance2(): <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> List<R> = throw Exception()
|
||||
|
||||
fun test(list: List<Int>) {
|
||||
list.filterIsInstance1<Int>().map { it * 2 }
|
||||
list.filterIsInstance2<Int>().filter { it > 10 }
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <R> foo(t: R): List<@kotlin.internal.NoInfer R> = throw Exception("$t")
|
||||
|
||||
fun test() {
|
||||
foo(1).map { it * 2 }
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <R> List<R>.foo(): <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> R = throw Exception()
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <R> bar(r: R, f: Function1<@kotlin.internal.NoInfer R, Unit>): Nothing = throw Exception()
|
||||
|
||||
fun test1() {
|
||||
listOf("").foo().length
|
||||
bar(1) { x -> x + 1 }
|
||||
}
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
//!DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@@ -28,4 +27,4 @@ fun <R> bar(r: R, f: Function1<@kotlin.internal.NoInfer R, Unit>): Nothing = thr
|
||||
fun test1() {
|
||||
listOf("").foo().length
|
||||
bar(1) { x -> x + 1 }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
public fun <T> Iterable<T>.contains1(element: T): Int<!> = null!!
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
public fun <T> Iterable<T>.contains1(element: @kotlin.internal.NoInfer T): Boolean<!> = null!!
|
||||
public fun <T> Iterable<T>.contains1(element: <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> T): Boolean<!> = null!!
|
||||
|
||||
|
||||
fun test() {
|
||||
|
||||
+5
-5
@@ -2,13 +2,13 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <T> test1(t1: T, t2: @kotlin.internal.NoInfer T): T = t1
|
||||
fun <T> test1(t1: T, t2: <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> T): T = t1
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <T> @kotlin.internal.NoInfer T.test2(t1: T): T = t1
|
||||
fun <T> <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> T.test2(t1: T): T = t1
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <T> test3(t1: @kotlin.internal.NoInfer T): T = t1
|
||||
fun <T> test3(t1: <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> T): T = t1
|
||||
|
||||
fun usage() {
|
||||
test1(1, "312")
|
||||
@@ -17,7 +17,7 @@ fun usage() {
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <T> List<T>.contains1(e: @kotlin.internal.NoInfer T): Boolean = true
|
||||
fun <T> List<T>.contains1(e: <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> T): Boolean = true
|
||||
|
||||
fun test(i: Int?, a: Any, l: List<Int>) {
|
||||
l.contains1(a)
|
||||
@@ -26,7 +26,7 @@ fun test(i: Int?, a: Any, l: List<Int>) {
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
fun <T> assertEquals1(e1: T, e2: @kotlin.internal.NoInfer T): Boolean = true
|
||||
fun <T> assertEquals1(e1: T, e2: <!HIDDEN, HIDDEN!>@kotlin.internal.NoInfer<!> T): Boolean = true
|
||||
|
||||
fun test(s: String) {
|
||||
assertEquals1(s, 11)
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
private object TopLevelTypeVariable {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN")
|
||||
fun <T> foo(): @kotlin.internal.NoInfer T = TODO()
|
||||
|
||||
fun <K> bar(k: K) {}
|
||||
@@ -15,7 +15,7 @@ private object TopLevelTypeVariable {
|
||||
private object NestedTypeVariable {
|
||||
class Inv<T>
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN")
|
||||
fun <T> foo(): Inv<@kotlin.internal.NoInfer T> = TODO()
|
||||
|
||||
fun <K> bar(p: Inv<K>) {}
|
||||
@@ -23,4 +23,4 @@ private object NestedTypeVariable {
|
||||
fun test() {
|
||||
bar(foo<String>())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ private object NestedTypeVariable {
|
||||
private constructor NestedTypeVariable()
|
||||
public final fun </*0*/ K> bar(/*0*/ p: NestedTypeVariable.Inv<K>): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public final fun </*0*/ T> foo(): NestedTypeVariable.Inv<T>
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN"}) public final fun </*0*/ T> foo(): NestedTypeVariable.Inv<T>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@@ -21,7 +21,7 @@ private object TopLevelTypeVariable {
|
||||
private constructor TopLevelTypeVariable()
|
||||
public final fun </*0*/ K> bar(/*0*/ k: K): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public final fun </*0*/ T> foo(): T
|
||||
@kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN"}) public final fun </*0*/ T> foo(): T
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun test(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
Reference in New Issue
Block a user