Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed
This commit is contained in:
@@ -9,7 +9,6 @@ import com.intellij.openapi.extensions.Extensions
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElementFinder
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import junit.framework.TestCase
|
||||
import org.jetbrains.kotlin.asJava.finder.JavaElementFinder
|
||||
import org.jetbrains.kotlin.backend.common.serialization.signature.IdSignatureDescriptor
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM
|
||||
@@ -37,23 +36,12 @@ abstract class AbstractFir2IrTextTest : AbstractIrTextTestCase() {
|
||||
}
|
||||
|
||||
override fun doTest(filePath: String) {
|
||||
val originalTextPath = filePath.replace(".kt", ".txt")
|
||||
val oldFrontendTextPath = filePath.replace(".kt", ".txt")
|
||||
val firTextPath = filePath.replace(".kt", ".fir.txt")
|
||||
val originalText = File(originalTextPath)
|
||||
val firText = File(firTextPath)
|
||||
if (originalText.exists() && firText.exists()) {
|
||||
val originalLines = originalText.readLines()
|
||||
val firLines = firText.readLines()
|
||||
TestCase.assertFalse(
|
||||
"Dumps via FIR & via old FE are the same. Please delete .fir.txt dump and add // FIR_IDENTICAL to test source",
|
||||
firLines.withIndex().all { (index, line) ->
|
||||
val trimmed = line.trim()
|
||||
val originalTrimmed = originalLines.getOrNull(index)?.trim()
|
||||
trimmed.isEmpty() && originalTrimmed?.isEmpty() != false || trimmed == originalTrimmed
|
||||
} && originalLines.withIndex().all { (index, line) ->
|
||||
index < firLines.size || line.trim().isEmpty()
|
||||
}
|
||||
)
|
||||
val oldFrontendTextFile = File(oldFrontendTextPath)
|
||||
val firTextFile = File(firTextPath)
|
||||
if (oldFrontendTextFile.exists() && firTextFile.exists()) {
|
||||
compareAndMergeFirFileAndOldFrontendFile(oldFrontendTextFile, firTextFile)
|
||||
}
|
||||
super.doTest(filePath)
|
||||
}
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
// http://youtrack.jetbrains.net/issue/KT-419
|
||||
|
||||
class A(w: Int) {
|
||||
var c = w
|
||||
|
||||
init {
|
||||
c = 81
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// http://youtrack.jetbrains.net/issue/KT-419
|
||||
|
||||
class A(w: Int) {
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
fun getArray(): Array<Int> = throw Exception()
|
||||
fun getList(): MutableList<Int> = throw Exception()
|
||||
fun fn() {
|
||||
getArray()[1] = 2
|
||||
getList()[1] = 2
|
||||
getArray()[1]++
|
||||
getList()[1]++
|
||||
getArray()[1] += 2
|
||||
getList()[1] += 2
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun getArray(): Array<Int> = throw Exception()
|
||||
fun getList(): MutableList<Int> = throw Exception()
|
||||
fun fn() {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
interface Base {
|
||||
fun f() = 1
|
||||
}
|
||||
|
||||
open class Left() : Base
|
||||
|
||||
interface Right : Base
|
||||
|
||||
class Diamond() : Left(), Right
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Base {
|
||||
fun f() = 1
|
||||
}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
interface Base<P> {
|
||||
fun f() = 1
|
||||
}
|
||||
|
||||
open class Left<P>() : Base<P>
|
||||
|
||||
interface Right<P> : Base<P>
|
||||
|
||||
class Diamond<P>() : Left<P>(), Right<P>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Base<P> {
|
||||
fun f() = 1
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package dollar
|
||||
|
||||
open class `$$$$$`() {
|
||||
}
|
||||
open class `$`() {
|
||||
}
|
||||
open class `$$`(`$$$$` : `$$$$$`?) : `$`() {
|
||||
val `$$$` : `$$$$$`? = `$$$$`
|
||||
open public fun `$$$$$$`() : `$$$$$`? {
|
||||
return `$$$`
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
package dollar
|
||||
|
||||
open class `$$$$$`() {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Here we want just to check return type
|
||||
// Should be () -> Int
|
||||
fun foo() = { 42 }
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// Here we want just to check return type
|
||||
// Should be () -> Int
|
||||
fun foo() = { 42 }
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
fun box() : String {
|
||||
val s = "abc"
|
||||
val test1 = """$s"""
|
||||
if (test1 != "abc") return "Fail 1: $test1"
|
||||
|
||||
val test2 = """${s}"""
|
||||
if (test2 != "abc") return "Fail 2: $test2"
|
||||
|
||||
val test3 = """ "$s" """
|
||||
if (test3 != " \"abc\" ") return "Fail 3: $test3"
|
||||
|
||||
val test4 = """ "${s}" """
|
||||
if (test4 != " \"abc\" ") return "Fail 4: $test4"
|
||||
|
||||
val test5 =
|
||||
"""
|
||||
${s.length}
|
||||
"""
|
||||
if (test5 != "\n 3\n") return "Fail 5: $test5"
|
||||
|
||||
val test6 = """\n"""
|
||||
if (test6 != "\\n") return "Fail 6: $test6"
|
||||
|
||||
val test7 = """\${'$'}foo"""
|
||||
if (test7 != "\\\$foo") return "Fail 7: $test7"
|
||||
|
||||
val test8 = """$ foo"""
|
||||
if (test8 != "$ foo") return "Fail 8: $test8"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
|
||||
fun new() : String {
|
||||
return """
|
||||
sdfasdf
|
||||
${<!UNRESOLVED_REFERENCE!>a<!>}
|
||||
ds"asdfas
|
||||
$<!UNRESOLVED_REFERENCE!>b<!>
|
||||
asgfaf
|
||||
"""
|
||||
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun box() : String {
|
||||
val s = "abc"
|
||||
val test1 = """$s"""
|
||||
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
abstract class B() {
|
||||
abstract fun foo2(arg: Int = 239) : Int
|
||||
}
|
||||
|
||||
class C() : B() {
|
||||
override fun foo2(arg: Int) : Int = arg
|
||||
}
|
||||
|
||||
fun invokeIt() {
|
||||
C().foo2()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
abstract class B() {
|
||||
abstract fun foo2(arg: Int = 239) : Int
|
||||
}
|
||||
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
|
||||
interface Aaa<T> {
|
||||
fun zzz(value: T): Unit
|
||||
}
|
||||
|
||||
class Bbb<T>() : Aaa<T> {
|
||||
override fun zzz(value: T) { }
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
var a = Bbb<Double>()
|
||||
a.zzz(10.0)
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
interface Aaa<T> {
|
||||
fun zzz(value: T): Unit
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import<!SYNTAX!><!>
|
||||
|
||||
fun firstFun() {}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
import<!SYNTAX!><!>
|
||||
|
||||
fun firstFun() {}
|
||||
@@ -1,9 +0,0 @@
|
||||
class Foo(val a: Int, b: Int) {
|
||||
val c = a + b
|
||||
|
||||
val d: Int
|
||||
get() = a
|
||||
|
||||
val e: Int
|
||||
get() = <!UNRESOLVED_REFERENCE!>b<!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Foo(val a: Int, b: Int) {
|
||||
val c = a + b
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// FILE: f.kt
|
||||
class A {
|
||||
}
|
||||
|
||||
// FILE: f.kt
|
||||
package n
|
||||
class B
|
||||
// FILE: f.kt
|
||||
abstract class XXX() {
|
||||
abstract val a : Int
|
||||
abstract val a2 : n.B
|
||||
abstract val a3 : (A)
|
||||
abstract val a31 : (n.B)
|
||||
abstract val a4 : A?
|
||||
abstract val a5 : (A)?
|
||||
abstract val a6 : (A?)
|
||||
abstract val a7 : (A) -> n.B
|
||||
abstract val a8 : (A, n.B) -> n.B
|
||||
|
||||
//val a9 : (A, B)
|
||||
//val a10 : (B)? -> B
|
||||
|
||||
val a11 : ((Int) -> Int)? = null
|
||||
val a12 : ((Int) -> (Int))? = null
|
||||
abstract val a13 : Int.(Int) -> Int
|
||||
abstract val a14 : n.B.(Int) -> Int
|
||||
abstract val a15 : Int? .(Int) -> Int
|
||||
abstract val a152 : (Int?).(Int) -> Int
|
||||
// abstract val a151 : Int?.(Int) -> Int
|
||||
abstract val a16 : (Int) -> (Int) -> Int
|
||||
abstract val a17 : ((Int) -> Int).(Int) -> Int
|
||||
abstract val a18 : (Int) -> ((Int) -> Int)
|
||||
abstract val a19 : ((Int) -> Int) -> Int
|
||||
}
|
||||
|
||||
abstract class YYY() {
|
||||
abstract val a7 : (a : A) -> n.B
|
||||
abstract val a8 : (a : A, b : n.B) -> n.B
|
||||
//val a9 : (A, B)
|
||||
//val a10 : (B)? -> B
|
||||
val a11 : ((a : Int) -> Int)? = null
|
||||
val a12 : ((a : Int) -> (Int))? = null
|
||||
abstract val a13 : Int.(a : Int) -> Int
|
||||
abstract val a14 : n.B.(a : Int) -> Int
|
||||
abstract val a15 : Int? .(a : Int) -> Int
|
||||
abstract val a152 : (Int?).(a : Int) -> Int
|
||||
//abstract val a151 : Int?.(a : Int) -> Int
|
||||
abstract val a16 : (a : Int) -> (a : Int) -> Int
|
||||
abstract val a17 : ((a : Int) -> Int).(a : Int) -> Int
|
||||
abstract val a18 : (a : Int) -> ((a : Int) -> Int)
|
||||
abstract val a19 : (b : (a : Int) -> Int) -> Int
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: f.kt
|
||||
class A {
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// dummy test of syntax error highlighting in tests
|
||||
|
||||
fun get() {
|
||||
1 + 2 <!SYNTAX!>2 3 4<!>
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// dummy test of syntax error highlighting in tests
|
||||
|
||||
fun get() {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
fun f() {<!SYNTAX!><!>
|
||||
@@ -1 +1,2 @@
|
||||
// FIR_IDENTICAL
|
||||
fun f() {<!SYNTAX!><!>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun test() {
|
||||
return checkSubtype<Unit>(Unit)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun test() {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// !LANGUAGE: -SingleUnderscoreForParameterName
|
||||
|
||||
val x = 1.let { arg -> }
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -SingleUnderscoreForParameterName
|
||||
|
||||
val x = 1.let { arg -> }
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
class Foo1() : java.util.ArrayList<Int>()
|
||||
|
||||
open class Bar() {
|
||||
fun v() : Int = 1
|
||||
val v : Int = 1
|
||||
}
|
||||
|
||||
class Barr() : Bar() {}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// JAVAC_EXPECTED_FILE
|
||||
class Foo1() : java.util.ArrayList<Int>()
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// KT-389 Wrong type inference for varargs etc.
|
||||
|
||||
import java.util.*
|
||||
|
||||
fun foob(vararg a : Byte) : ByteArray = a
|
||||
fun fooc(vararg a : Char) : CharArray = a
|
||||
fun foos(vararg a : Short) : ShortArray = a
|
||||
fun fooi(vararg a : Int) : IntArray = a
|
||||
fun fool(vararg a : Long) : LongArray = a
|
||||
fun food(vararg a : Double) : DoubleArray = a
|
||||
fun foof(vararg a : Float) : FloatArray = a
|
||||
fun foob(vararg a : Boolean) : BooleanArray = a
|
||||
fun foos(vararg a : String) : Array<out String> = a
|
||||
|
||||
fun test() {
|
||||
Arrays.asList(1, 2, 3)
|
||||
Arrays.asList<Int>(1, 2, 3)
|
||||
|
||||
foob(1, 2, 3)
|
||||
foos(1, 2, 3)
|
||||
fooc('1', '2', '3')
|
||||
fooi(1, 2, 3)
|
||||
fool(1, 2, 3)
|
||||
food(1.0, 2.0, 3.0)
|
||||
foof(1.0.toFloat(), 2.0.toFloat(), 3.0.toFloat())
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// KT-389 Wrong type inference for varargs etc.
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
annotation class ann
|
||||
class Annotated(@ann val x: Int)
|
||||
@@ -1,2 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class ann
|
||||
class Annotated(@ann val x: Int)
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
annotation class My
|
||||
|
||||
fun foo() {
|
||||
val s = object {
|
||||
@My fun bar() {}
|
||||
}
|
||||
s.bar()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class My
|
||||
|
||||
fun foo() {
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
annotation class My
|
||||
|
||||
fun foo(): Int {
|
||||
val s = object {
|
||||
@My val bar: Int = 0
|
||||
}
|
||||
return s.bar
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class My
|
||||
|
||||
fun foo(): Int {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class My
|
||||
|
||||
fun foo() {
|
||||
for (i: @My Int in 0..41) {
|
||||
if (i == 13) return
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class My
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
// Result type can be annotated
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class My(val x: Int)
|
||||
|
||||
fun foo(): @My(42) Int = 24
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// Result type can be annotated
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class My(val x: Int)
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
annotation class My
|
||||
|
||||
fun foo(arg: Int): Int {
|
||||
try {
|
||||
return 1 / (arg - arg)
|
||||
} catch (e: @My Exception) {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class My
|
||||
|
||||
fun foo(arg: Int): Int {
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
annotation class Base(val x: Int)
|
||||
|
||||
annotation class UseBase(val b: Base = Base(0))
|
||||
|
||||
@UseBase class My
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class Base(val x: Int)
|
||||
|
||||
annotation class UseBase(val b: Base = Base(0))
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
package test
|
||||
|
||||
annotation class A(val a: Int = 12, val b: String = "Test", val c: String)
|
||||
|
||||
@A(a = 12, c = "Hello")
|
||||
object SomeObject
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
package test
|
||||
|
||||
annotation class A(val a: Int = 12, val b: String = "Test", val c: String)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
annotation class Ann
|
||||
|
||||
class C {
|
||||
fun foo() {
|
||||
class Local {
|
||||
@Ann<!SYNTAX!><!>
|
||||
}
|
||||
}
|
||||
|
||||
@Ann<!SYNTAX!><!>
|
||||
}
|
||||
|
||||
@Ann<!SYNTAX!><!>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class Ann
|
||||
|
||||
class C {
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
annotation class Ann
|
||||
|
||||
class C {
|
||||
fun test() {
|
||||
@Ann<!SYNTAX!><!>
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
class Local {
|
||||
@Ann<!SYNTAX!><!>
|
||||
}
|
||||
}
|
||||
@Ann<!SYNTAX!><!>
|
||||
}
|
||||
|
||||
@Ann<!SYNTAX!><!>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class Ann
|
||||
|
||||
class C {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Class CAN be recursively annotated
|
||||
@RecursivelyAnnotated(1)
|
||||
annotation class RecursivelyAnnotated(val x: Int)
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// Class CAN be recursively annotated
|
||||
@RecursivelyAnnotated(1)
|
||||
annotation class RecursivelyAnnotated(val x: Int)
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
// Properties can be recursively annotated
|
||||
annotation class ann(val x: Int)
|
||||
@ann(x) const val x: Int = 1
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// Properties can be recursively annotated
|
||||
annotation class ann(val x: Int)
|
||||
@ann(x) const val x: Int = 1
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
// Class constructor parameter CAN be recursively annotated
|
||||
annotation class RecursivelyAnnotated(@RecursivelyAnnotated(1) val x: Int)
|
||||
+1
@@ -1,2 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// Class constructor parameter CAN be recursively annotated
|
||||
annotation class RecursivelyAnnotated(@RecursivelyAnnotated(1) val x: Int)
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
// Class constructor parameter type CAN be recursively annotated
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class RecursivelyAnnotated(val x: @RecursivelyAnnotated(1) Int)
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// Class constructor parameter type CAN be recursively annotated
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class RecursivelyAnnotated(val x: @RecursivelyAnnotated(1) Int)
|
||||
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
// Class constructor parameter CAN be recursively annotated
|
||||
annotation class RecursivelyAnnotated(@RecursivelyAnnotated(1) val x: Int)
|
||||
+1
@@ -1,2 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// Class constructor parameter CAN be recursively annotated
|
||||
annotation class RecursivelyAnnotated(@RecursivelyAnnotated(1) val x: Int)
|
||||
@@ -1,11 +0,0 @@
|
||||
// This test checks that annotations on extension function types are preserved. See the corresponding .txt file
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class ann
|
||||
|
||||
interface Some {
|
||||
fun f1(): String.() -> Int
|
||||
fun f2(): @ExtensionFunctionType() (String.() -> Int)
|
||||
fun f3(): @ann String.() -> Int
|
||||
fun f4(): @ExtensionFunctionType @ann() (String.() -> Int)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// This test checks that annotations on extension function types are preserved. See the corresponding .txt file
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
|
||||
-4
@@ -1,4 +0,0 @@
|
||||
// !DIAGNOSTICS: -FINAL_SUPERTYPE
|
||||
// This error needs to be suppressed to cause light class generation
|
||||
|
||||
class Foo : Target()
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -FINAL_SUPERTYPE
|
||||
// This error needs to be suppressed to cause light class generation
|
||||
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
// !DIAGNOSTICS: -SUPERTYPES_FOR_ANNOTATION_CLASS -VIRTUAL_MEMBER_HIDDEN -FINAL_SUPERTYPE -MISSING_DEPENDENCY_SUPERCLASS
|
||||
// These errors need to be suppressed to cause light class generation
|
||||
// FILE: test.kt
|
||||
|
||||
annotation class Ann : Target()
|
||||
|
||||
annotation class Ann2(vararg val allowedTargets: AnnotationTarget) : Target()
|
||||
|
||||
interface I : J {
|
||||
override fun foo(): List<String> = throw Exception()
|
||||
}
|
||||
class C : I {
|
||||
fun bar(): Set<Number> = throw Exception()
|
||||
}
|
||||
annotation class Ann3 : C()
|
||||
annotation class Ann4 : I
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
import java.util.Collection;
|
||||
import kotlin.annotation.Target;
|
||||
|
||||
public interface J extends Target {
|
||||
Collection<String> foo();
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -SUPERTYPES_FOR_ANNOTATION_CLASS -VIRTUAL_MEMBER_HIDDEN -FINAL_SUPERTYPE -MISSING_DEPENDENCY_SUPERCLASS
|
||||
// These errors need to be suppressed to cause light class generation
|
||||
// FILE: test.kt
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
annotation class Ann(val x: Int, val<!SYNTAX!><!> )
|
||||
@@ -1 +1,2 @@
|
||||
// FIR_IDENTICAL
|
||||
annotation class Ann(val x: Int, val<!SYNTAX!><!> )
|
||||
@@ -1,5 +0,0 @@
|
||||
fun foo() = @ann 1
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ann
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun foo() = @ann 1
|
||||
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
fun test() {
|
||||
@ann
|
||||
while (2 < 1) {}
|
||||
|
||||
@ann
|
||||
do {} while (2 < 1)
|
||||
|
||||
@ann
|
||||
for (i in 1..2) {}
|
||||
}
|
||||
|
||||
annotation class ann
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun test() {
|
||||
@ann
|
||||
while (2 < 1) {}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class Annotation(val x: Int) {
|
||||
fun baz() {}
|
||||
fun bar() = x
|
||||
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
class Annotation {
|
||||
fun setProblemGroup() {}
|
||||
fun getQuickFixes() = 0
|
||||
}
|
||||
|
||||
fun registerQuickFix(annotation: Annotation) {
|
||||
annotation.setProblemGroup()
|
||||
val fixes = annotation.getQuickFixes()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
class Annotation {
|
||||
fun setProblemGroup() {}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
@MustBeDocumented
|
||||
annotation class DocAnn
|
||||
|
||||
annotation class NotDocAnn
|
||||
|
||||
@DocAnn class My
|
||||
|
||||
@NotDocAnn class Your
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@MustBeDocumented
|
||||
annotation class DocAnn
|
||||
|
||||
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ExprAnn
|
||||
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
annotation class FunAnn
|
||||
|
||||
fun foo(): Int {
|
||||
val x = @ExprAnn fun() = 1
|
||||
val y = @FunAnn fun() = 2
|
||||
return x() + y()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.EXPRESSION)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class ExprAnn
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// FILE: DocumentedAnnotations.java
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
public class DocumentedAnnotations {
|
||||
|
||||
@Documented public @interface DocAnn {};
|
||||
|
||||
public @interface NotDocAnn {};
|
||||
|
||||
@Documented @Retention(RetentionPolicy.RUNTIME) public @interface RunDocAnn {};
|
||||
}
|
||||
|
||||
// FILE: DocumentedAnnotations.kt
|
||||
|
||||
@DocumentedAnnotations.DocAnn class My
|
||||
|
||||
@DocumentedAnnotations.NotDocAnn class Your
|
||||
|
||||
@DocumentedAnnotations.RunDocAnn class His
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: DocumentedAnnotations.java
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
// FILE: AnnotationRetentions.java
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
public class AnnotationRetentions {
|
||||
|
||||
public @interface BaseAnnotation {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SourceAnnotation {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface BinaryAnnotation {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RuntimeAnnotation {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: AnnotationRetentions.kt
|
||||
|
||||
@AnnotationRetentions.BaseAnnotation class BaseClass
|
||||
|
||||
@AnnotationRetentions.SourceAnnotation class SourceClass
|
||||
|
||||
@AnnotationRetentions.BinaryAnnotation class BinaryClass
|
||||
|
||||
@AnnotationRetentions.RuntimeAnnotation class RuntimeClass
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: AnnotationRetentions.java
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class Ann
|
||||
|
||||
open class My
|
||||
|
||||
fun foo(): My {
|
||||
return (@Ann object: My() {})
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class Ann
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class sourceann
|
||||
|
||||
@sourceann class AnnotatedAtSource
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
annotation class sourceann
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class base
|
||||
|
||||
@base data class My(val x: Int)
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
annotation class base
|
||||
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
@file:Suppress("abc")
|
||||
|
||||
fun foo(): Int {
|
||||
@Suppress("xyz") return 1
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
@file:Suppress("abc")
|
||||
|
||||
fun foo(): Int {
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||
class A
|
||||
|
||||
@Target(AnnotationTarget.TYPE)
|
||||
annotation class x
|
||||
|
||||
fun @x A.foo(a: @x Int) {
|
||||
val v: @x Int = 1
|
||||
}
|
||||
|
||||
fun <T> @x List<@x T>.foo(l: List<@x T>): @x List<@x T> = throw Exception()
|
||||
|
||||
fun <T, U: T> List<@x T>.firstTyped(): U = throw Exception()
|
||||
|
||||
val <T> @x List<@x T>.f: Int get() = 42
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
|
||||
class A
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user