[FIR] move deprecation calculation to COMPILER_REQUIRED_ANNOTATIONS phase

Also, this change adds SinceKotlin and Java.Deprecated to this phase
It fixes some problems with API_NOT_AVAILABLE, so now it is closer to K1

^KT-57648 Fixed
^KT-55723 Fixed
This commit is contained in:
Dmitrii Gridin
2023-05-10 16:26:25 +02:00
committed by Space Team
parent add47aa041
commit 9a267176f5
23 changed files with 171 additions and 122 deletions
@@ -6,6 +6,6 @@ annotation class Anno1(val s: String)
annotation class Anno2 @SinceKotlin("1.1") constructor()
@Anno1("")
@<!API_NOT_AVAILABLE!>Anno1<!>("")
@<!UNRESOLVED_REFERENCE!>Anno2<!>
fun t1() {}
@@ -11,13 +11,13 @@ class Baz @SinceKotlin("1.1") constructor()
@SinceKotlin("1.1")
class Quux @SinceKotlin("1.0") constructor()
fun t1(): Foo = Foo()
fun t1(): <!API_NOT_AVAILABLE!>Foo<!> = <!API_NOT_AVAILABLE!>Foo<!>()
// TODO: do not report API_NOT_AVAILABLE twice
fun t2() = object : Foo() {}
fun t2() = object : <!API_NOT_AVAILABLE!>Foo<!>() {}
fun t3(): Bar? = <!UNRESOLVED_REFERENCE!>Bar<!>()
fun t4(): Baz = <!UNRESOLVED_REFERENCE!>Baz<!>()
fun t5(): Quux = Quux()
fun t5(): <!API_NOT_AVAILABLE!>Quux<!> = <!API_NOT_AVAILABLE!>Quux<!>()
@@ -3,7 +3,7 @@
@SinceKotlin("1.1")
open class C1
typealias C1_Alias = C1
typealias C1_Alias = <!API_NOT_AVAILABLE!>C1<!>
open class C2(val x: Int) {
@SinceKotlin("1.1")
@@ -12,9 +12,9 @@ open class C2(val x: Int) {
typealias C2_Alias = C2
val test1 = C1_Alias()
val test1 = <!API_NOT_AVAILABLE!>C1_Alias<!>()
val test2 = <!NO_VALUE_FOR_PARAMETER!>C2_Alias()<!>
class Test3 : C1_Alias()
class Test3 : <!API_NOT_AVAILABLE!>C1_Alias<!>()
class Test4 : <!NO_VALUE_FOR_PARAMETER!>C2_Alias<!>()
@@ -5,7 +5,7 @@ object Since_1_1 {
val x = 42
}
typealias Since_1_1_Alias = Since_1_1
typealias Since_1_1_Alias = <!API_NOT_AVAILABLE!>Since_1_1<!>
val test1 = Since_1_1_Alias
val test2 = Since_1_1_Alias.x
val test2 = Since_1_1_Alias.x
@@ -5,17 +5,17 @@ class Since_1_1
class C
typealias Since_1_1_Alias = Since_1_1
typealias Since_1_1_Alias = <!API_NOT_AVAILABLE!>Since_1_1<!>
typealias L = List<Since_1_1>
typealias L = List<<!API_NOT_AVAILABLE!>Since_1_1<!>>
@SinceKotlin("1.1")
typealias C_1_1_Alias = C
fun test1(x: Since_1_1_Alias) = x
fun test1(x: <!API_NOT_AVAILABLE!>Since_1_1_Alias<!>) = x
fun test2(x: C_1_1_Alias) = x
fun test2(x: <!API_NOT_AVAILABLE!>C_1_1_Alias<!>) = x
fun test3(x: List<C_1_1_Alias>) = x
fun test3(x: List<<!API_NOT_AVAILABLE!>C_1_1_Alias<!>>) = x
fun test4(x: L) = x
fun test4(x: <!API_NOT_AVAILABLE!>L<!>) = x
@@ -6,7 +6,7 @@ package a
@SinceKotlin("1.1")
class Since_1_1
typealias Since_1_1_Alias = Since_1_1
typealias Since_1_1_Alias = <!API_NOT_AVAILABLE!>Since_1_1<!>
@SinceKotlin("1.1")
typealias Alias_1_1 = String
@@ -14,5 +14,5 @@ typealias Alias_1_1 = String
// FILE: b.kt
package b
import a.Since_1_1_Alias
import a.Alias_1_1
import a.<!API_NOT_AVAILABLE!>Since_1_1_Alias<!>
import a.Alias_1_1