K2 Scripting: add annotation resolving for scripts

#KT-62400 fixed
This commit is contained in:
Ilya Chernikov
2023-10-06 14:24:49 +02:00
committed by Space Team
parent 31f9e9e7a8
commit 02dc3c4ddb
2 changed files with 26 additions and 0 deletions
@@ -33,6 +33,17 @@ class ScriptCompilerTest : TestCase() {
assertTrue(res.reports.none { it.message.contains("nonsense") })
}
fun testDeprecationAnnotation() {
val res = compile("""
@Deprecated("BECAUSE")
fun deprecatedFunction() {}
deprecatedFunction()
""".trimIndent().toScriptSource()) {}
assertTrue(res is ResultWithDiagnostics.Success)
assertTrue(res.reports.any { it.message.contains("deprecatedFunction(): Unit' is deprecated. BECAUSE") })
}
fun testSimpleVarAccess() {
val res = compileToClass(
"""