[FIR] Improve annotation use-site target rendring for diagnostics

#KT-62816 Fixed
This commit is contained in:
Kirill Rakhman
2023-12-21 17:45:02 +01:00
committed by Space Team
parent 8f3f72d9c9
commit 5d3738c804
6 changed files with 35 additions and 9 deletions
@@ -1,9 +1,13 @@
/deprecatedError.kt:10:13: error: using 'C' is an error. alas
/deprecatedError.kt:14:13: error: using 'C' is an error. alas
fun test(c: C) {
^
/deprecatedError.kt:11:5: error: using 'foo(String): Unit' is an error. alas
/deprecatedError.kt:15:5: error: using 'foo(String): Unit' is an error. alas
foo("")
^
/deprecatedError.kt:12:5: error: using 'C' is an error. alas
/deprecatedError.kt:16:5: error: using 'C' is an error. alas
C()
^
/deprecatedError.kt:17:5: error: using 'bar: Int' is an error. alas
bar
^
@@ -1,5 +1,7 @@
/deprecatedError.kt:(237,238): error: '@Deprecated(...) class C : Any' is deprecated. alas.
/deprecatedError.kt:(319,320): error: '@Deprecated(...) class C : Any' is deprecated. alas.
/deprecatedError.kt:(246,249): error: '@Deprecated(...) fun foo(s: @Foo() String): Unit' is deprecated. alas.
/deprecatedError.kt:(328,331): error: '@Deprecated(...) fun foo(s: @Foo() String): Unit' is deprecated. alas.
/deprecatedError.kt:(258,259): error: 'constructor(): C' is deprecated. alas.
/deprecatedError.kt:(340,341): error: 'constructor(): C' is deprecated. alas.
/deprecatedError.kt:(348,351): error: '@Deprecated(...) @field:Foo() val bar: Int' is deprecated. alas.
@@ -7,10 +7,15 @@ fun foo(s: @Foo String) {}
@Deprecated("alas", level = DeprecationLevel.ERROR)
class C
@field:Foo
@Deprecated("alas", level = DeprecationLevel.ERROR)
val bar: Int = 42
fun test(c: <!DEPRECATION_ERROR!>C<!>) {
<!DEPRECATION_ERROR!>foo<!>("")
<!DEPRECATION_ERROR!>C<!>()
<!DEPRECATION_ERROR!>bar<!>
}
@Target(AnnotationTarget.TYPE)
@Target(AnnotationTarget.TYPE, AnnotationTarget.FIELD)
annotation class Foo