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,11 +0,0 @@
package b
class A {
operator fun <T> get(i: Int): List<T> = throw Exception("$i")
}
fun bar(l: List<Int>) = l
fun test(a: A) {
bar(a[12])
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package b
class A {
@@ -1,8 +0,0 @@
fun <T> foo(t: T) = t
fun test(map: MutableMap<Int, Int>, t: Int) {
map [t] = foo(t) // t was marked with black square
}
//from library
operator fun <K, V> MutableMap<K, V>.set(key : K, value : V) : V? = this.put(key, value)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun <T> foo(t: T) = t
fun test(map: MutableMap<Int, Int>, t: Int) {
@@ -1,19 +0,0 @@
package a
import java.util.ArrayList
public fun <T> Iterable<T>.withIndices(): List<Pair<Int, T>> {
val answer = ArrayList<Pair<Int, T>>()
var nextIndex = 1
for (e in this) {
answer.add(Pair(nextIndex, e))
nextIndex++
}
return answer
}
//from standard library
public class Pair<out A, out B>(
public val first: A,
public val second: B
)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package a
import java.util.ArrayList
@@ -1,12 +0,0 @@
// !CHECK_TYPE
package aaa
infix fun <T> T.foo(t: T) = t
fun <T> id(t: T) = t
fun a() {
val i = id(2 foo 3)
checkSubtype<Int>(i) // i shouldn't be resolved to error element
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
package aaa
@@ -1,15 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
open class Cls
abstract class In<in I>
class SubIn : In<Cls?>()
inline fun <reified T : Cls> materialize(): T? = TODO()
fun <D> transform(transformer: In<D>, data: D): Unit = TODO()
fun test(subIn: SubIn) {
transform(subIn, materialize()) // D should be inferred to Cls?, not Nothing?
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER