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,6 +0,0 @@
fun <T: Any> test(f: (T) -> T?) {
doFun(f.ext())
}
fun <E : Any> Function1<E, E?>.ext(): Function0<E?> = throw Exception()
fun <R : Any> doFun(f: () -> R?) = f
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun <T: Any> test(f: (T) -> T?) {
doFun(f.ext())
}
@@ -1,11 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import java.util.*
fun test(list: ArrayList<Int>, comparatorFun: (Int, Int) -> Int) {
sort(list, Comparator(comparatorFun))
}
public fun <E> sort(list: List<E>, c: Comparator<in E>) {
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import java.util.*
@@ -1,17 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class GenericClass<out T>
public fun <K, V> GenericClass<Map<K, V>>.foo() {}
public fun <T> bar(t: T, ext: GenericClass<T>.() -> Unit) {}
fun test() {
bar(mapOf(2 to 3)) { foo() }
}
// from library
class Pair<out A, out B>
fun <K, V> mapOf(keyValuePair: Pair<K, V>): Map<K, V> = throw Exception()
infix fun <A, B> A.to(that: B): Pair<A, B> = throw Exception()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class GenericClass<out T>
@@ -1,9 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class GenericClass<out T>(val value: T) {
public fun <P> foo(extension: T.() -> P) {}
}
public fun <E> GenericClass<List<E>>.bar() {
foo( { listIterator() })
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
class GenericClass<out T>(val value: T) {
@@ -1,13 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import java.util.*
interface Foo
class Bar<B : Foo>(val list: MutableList<B>) {}
fun <F : Foo> test(map: MutableMap<String, Bar<F>>) {
map.getOrPut1("", { Bar(ArrayList()) })
}
fun <K, V> MutableMap<K, V>.getOrPut1(key: K, defaultValue: () -> V): V = throw Exception()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import java.util.*
@@ -1,12 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !WITH_NEW_INFERENCE
open class View
fun test() {
val target = foo<View>() ?: foo() ?: run {}
}
fun <T : View> foo(): T? {
return null
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !WITH_NEW_INFERENCE
@@ -1,178 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
val prop = mapOf(
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b"),
to("a", "b")
)
fun <A, B> to(a: A, b: B): Pair<A, B> = TODO()
fun <K, V> mapOf(vararg pairs: Pair<K, V>): Map<K, V> = TODO()
class Pair<out A, out B>
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -1,12 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
class Inv<T>
fun <K> select(x: K, y: K): K = x
fun <V> outToOut(x: Inv<out V>): Inv<out V> = TODO()
fun test(invOutAny: Inv<out Any>, invAny: Inv<Any>) {
val a: Inv<out Any> = select(invAny, outToOut(invOutAny))
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
@@ -1,20 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
class In<in T>
class Out<out T>
class A
class B
fun <K> select(x: K, y: K): K = x
fun <V> genericIn(x: In<V>) {}
fun <V> genericOut(x: Out<V>) {}
fun test1(a: In<A>, b: In<B>) {
genericIn(select(a, b))
}
fun test2(a: Out<A>, b: Out<B>) {
genericOut(select(a, b))
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -1,8 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun takeLong(i: Long) {}
fun test() {
takeLong(if (true) 1 else 0)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER