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,9 +0,0 @@
open class A {
fun foo() = 42
object B: A()
}
fun test() {
(A::foo)(A.B)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
open class A {
fun foo() = 42
@@ -1,19 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A {
fun main() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
}
class SomeOtherClass {
fun main() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,22 +0,0 @@
// FILE: A.kt
open class A<T>(val x: T)
// FILE: AFactory.kt
abstract class AFactory {
abstract fun create(): A<Int>?
}
// FILE: Util.kt
inline fun <reified T> createWith(x: T, f: (T) -> A<T>?)
= f(x)
// FILE: B.kt
class B(x: Int) : A<Int>(x) {
companion object : AFactory() {
override fun create(): A<Int>? = createWith(0, ::B)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: A.kt
open class A<T>(val x: T)
@@ -1,14 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A
class B
fun A.ext() {
val x = ::A
val y = ::B
checkSubtype<KFunction0<A>>(x)
checkSubtype<KFunction0<B>>(y)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,23 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A
class B {
fun A.ext() {
val x = ::A
val y = ::B
checkSubtype<KFunction0<A>>(x)
checkSubtype<KFunction0<B>>(y)
}
fun B.ext() {
val x = ::A
val y = ::B
checkSubtype<KFunction0<A>>(x)
checkSubtype<KFunction0<B>>(y)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,11 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A
fun main() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,6 +0,0 @@
class A
fun main() {
val x = :: <!SYNTAX!><!>;
val y = A::
<!SYNTAX!><!>}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A
fun main() {
@@ -1,12 +0,0 @@
// !DIAGNOSTICS:-UNUSED_VARIABLE
import kotlin.reflect.*
class A {
fun foo() {}
}
fun A?.foo() {}
val f: KFunction1<A, Unit> = A::foo
val g: KFunction1<A, Unit> = A?::foo
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS:-UNUSED_VARIABLE
import kotlin.reflect.*
@@ -1,13 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction1
class A<T>(val t: T) {
fun foo(): T = t
}
fun bar() {
val x = A<String>::foo
checkSubtype<KFunction1<A<String>, String>>(x)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction1
@@ -1,24 +0,0 @@
// !CHECK_TYPE
// FILE: test/A.java
package test;
import java.util.Arrays;
public class A {
public static void main(String[] args) {
System.out.println(Arrays.asList(args));
}
}
// FILE: 1.kt
import kotlin.reflect.*
import test.A
fun foo(args: Array<String>) {
val main2 = A::main
checkSubtype<KFunction1<Array<String>, Unit>>(main2)
main2(args)
(A::main)(args)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// FILE: test/A.java
@@ -1,10 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
fun main() {
class A
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,18 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
fun main() {
class A
class B {
fun Int.foo() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
fun A.foo() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,10 +0,0 @@
import kotlin.reflect.KFunction0
fun main() {
class A
class B {
val x = ::A
val f: KFunction0<A> = x
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
import kotlin.reflect.KFunction0
fun main() {
@@ -1,17 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
fun main() {
class A
fun A.foo() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
fun Int.foo() {
val x = ::A
checkSubtype<KFunction0<A>>(x)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,18 +0,0 @@
// !CHECK_TYPE
// FILE: a.kt
package a.b.c
class D {
fun foo() = 42
}
// FILE: b.kt
import kotlin.reflect.KFunction1
fun main() {
val x = a.b.c.D::foo
checkSubtype<KFunction1<a.b.c.D, Int>>(x)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// FILE: a.kt
@@ -1,13 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KFunction0
class A {
class Nested
}
fun main() {
val x = A::Nested
checkSubtype<KFunction0<A.Nested>>(x)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KFunction0
@@ -1,8 +0,0 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun bar() = 42
fun main() {
fun bar() = 239
::bar
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_EXPRESSION
fun bar() = 42
@@ -1,10 +0,0 @@
// SKIP_TXT
// FILE: A.java
class A {
private static void foo() {}
public String foo(int x) {}
}
// FILE: main.kt
fun main() {
(A::foo)(A(), 1)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
// FILE: A.java
class A {