Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user