Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed

This commit is contained in:
Mikhail Glukhikh
2020-03-04 17:54:33 +03:00
parent 186e0b0cba
commit 8884cbe415
2268 changed files with 1175 additions and 19754 deletions
@@ -1,12 +0,0 @@
enum class E : T {
ENTRY {
override fun f() {
}
};
abstract override fun f()
}
interface T {
fun f()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E : T {
ENTRY {
override fun f() {
@@ -1,9 +0,0 @@
// KT-7753 false positive: enum constructor can be called from secondary constructor
enum class A(val c: Int) {
ONE(1),
TWO(2),
THREE(3),
FORTY_TWO();
constructor(): this(42)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-7753 false positive: enum constructor can be called from secondary constructor
enum class A(val c: Int) {
ONE(1),
@@ -1,9 +0,0 @@
enum class E {
ENTRY;
companion object {
fun entry() = ENTRY
}
}
fun bar() = E.entry()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E {
ENTRY;
@@ -1,7 +0,0 @@
// KT-5943 StackOverflowError from commonSupertype of two enums
// NI_EXPECTED_FILE
enum class A { A }
enum class B { B }
val x = if (true) A.A else B.B
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-5943 StackOverflowError from commonSupertype of two enums
// NI_EXPECTED_FILE
@@ -1,4 +0,0 @@
enum class E {
A; // no constructor call needed
constructor()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E {
A; // no constructor call needed
constructor()
@@ -1,14 +0,0 @@
import java.lang.annotation.RetentionPolicy
enum class E {
ENTRY
}
// Test resolve from source
val a: Enum<E> = E.ENTRY
// Test Java resolve
val b: Enum<RetentionPolicy> = RetentionPolicy.RUNTIME
// Test deserialized resolve
val c: Enum<AnnotationTarget> = AnnotationTarget.CLASS
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
import java.lang.annotation.RetentionPolicy
enum class E {
@@ -1,6 +0,0 @@
// Error: name should present
enum class<!SYNTAX!><!>(val rgb : Int) {
RED(0xFF000),
GREEN(0x00FF00),
BLUE(0x0000FF)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// Error: name should present
enum class<!SYNTAX!><!>(val rgb : Int) {
RED(0xFF000),
@@ -1,2 +0,0 @@
enum class<!SYNTAX!><!> {
}
@@ -1,2 +1,3 @@
// FIR_IDENTICAL
enum class<!SYNTAX!><!> {
}
@@ -1,8 +0,0 @@
enum class E {
entry
}
val Int.entry: Int get() = 42
val Long.entry: Int get() = 239
val e = E.entry
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E {
entry
}
@@ -1,7 +0,0 @@
// FILE: test.kt
package test
import java.util.concurrent.TimeUnit.*
val c = SECONDS
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: test.kt
package test
@@ -1,3 +0,0 @@
enum class My {
inline
}
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class My {
inline
}
@@ -1,19 +0,0 @@
class A {
enum class E {
ENTRY
}
companion object {
}
}
class B {
companion object {
}
enum class E {
ENTRY
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
enum class E {
ENTRY
@@ -1,5 +0,0 @@
class A {
enum class E {
ENTRY
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
enum class E {
ENTRY
@@ -1,7 +0,0 @@
class A {
companion object {
enum class E {
ENTRY
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
companion object {
enum class E {
@@ -1,7 +0,0 @@
enum class E {
ABC;
enum class F {
DEF
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E {
ABC;
@@ -1,5 +0,0 @@
object A {
enum class E {
ENTRY
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
object A {
enum class E {
ENTRY
@@ -1,5 +0,0 @@
interface A {
enum class E {
ENTRY
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface A {
enum class E {
ENTRY
@@ -1,11 +0,0 @@
class A {
enum class E {
ENTRY
}
companion object {
enum class E {
ENTRY2
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
enum class E {
ENTRY
@@ -1,4 +0,0 @@
class A {
enum class E { ABC }
enum class F { DEF }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
enum class E { ABC }
enum class F { DEF }
@@ -1,10 +0,0 @@
// !CHECK_TYPE
// FILE: A.java
public enum A {
ENTRY;
}
// FILE: test.kt
fun main() {
checkSubtype<A>(A.valueOf("ENTRY"))
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// FILE: A.java
public enum A {
@@ -1,11 +0,0 @@
// !CHECK_TYPE
// FILE: A.java
public enum A {
ENTRY,
ANOTHER;
}
// FILE: test.kt
fun main() {
checkSubtype<Array<A>>(A.values())
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// FILE: A.java
public enum A {
@@ -1,16 +0,0 @@
// !CHECK_TYPE
// FILE: A.java
public enum A {
ENTRY {
public String s() {
return "s";
}
};
public abstract String s();
}
// FILE: test.kt
fun main() {
checkSubtype<String?>(A.ENTRY.s())
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// FILE: A.java
public enum A {
@@ -1,16 +0,0 @@
// FILE: A.java
public enum A {
ENTRY,
ANOTHER;
public String s() {
return "";
}
}
// FILE: test.kt
fun main() {
val c = A.ENTRY
c.s()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: A.java
public enum A {
ENTRY,
@@ -1,19 +0,0 @@
// FILE: A.java
public enum A {
ENTRY("1"),
ANOTHER("2");
public String s;
private A(String s) {
this.s = s;
}
}
// FILE: test.kt
fun main() {
val c = A.ENTRY
c.s
A.ANOTHER.s
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: A.java
public enum A {
ENTRY("1"),
@@ -1,6 +0,0 @@
private enum class MethodKind {
INSTANCE,
STATIC
}
private fun MethodKind.hasThis() = this == MethodKind.INSTANCE
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
private enum class MethodKind {
INSTANCE,
STATIC
@@ -1,8 +0,0 @@
enum class E(val x: Int, val y: Int) {
A(1, 2),
B(1),
C; // no constructor call needed even here
constructor(): this(0, 0)
constructor(x: Int): this(x, 0)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E(val x: Int, val y: Int) {
A(1, 2),
B(1),
@@ -1,24 +0,0 @@
// FILE: E.kt
package foo
enum class E {
ENTRY,
ANOTHER;
class Nested {
companion object {
fun foo() = 42
}
}
}
// FILE: main.kt
package bar
import foo.E.*
fun f1() = ENTRY
fun f2() = ANOTHER
fun f3() = Nested()
fun f4() = Nested.foo()
fun f5() = values()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: E.kt
package foo
@@ -1,18 +0,0 @@
enum class E {
ENTRY;
companion object {
fun foo(): E = ENTRY
fun bar(): Array<E> = values()
fun baz(): E = valueOf("ENTRY")
val valuez = values()
}
fun oof(): E = ENTRY
fun rab(): Array<E> = values()
fun zab(): E = valueOf("ENTRY")
}
fun foo() = E.ENTRY
fun bar() = E.values()
fun baz() = E.valueOf("ENTRY")
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
enum class E {
ENTRY;