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,15 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Parent
interface Inv<T>
object Child : Parent
fun <K : Parent> wrapper(): Inv<K> = TODO()
fun <T : Parent> consume(wrapper: Inv<T>) {}
fun <S> select(x: S, y: S): S = x
fun error(f: Inv<out Parent>, w: Inv<Child>) {
consume(select(f, wrapper<Child>()))
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Parent
@@ -1,5 +0,0 @@
interface Box<out R>
fun <R> List<Box<R>>.choose(): Box<R>? = TODO()
fun list(): List<Box<*>> = TODO()
fun f() = list().choose()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface Box<out R>
fun <R> List<Box<R>>.choose(): Box<R>? = TODO()
fun list(): List<Box<*>> = TODO()
@@ -1,19 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kt7351
interface Node
interface Source<T> {
fun f() : T
}
fun <T, S : Source<T>> S.woo() : T = this.f()
fun Node.append(block : Source<Int>.() -> Unit) {
}
fun crashMe(node : Node) {
node.append {
woo()
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
package kt7351
@@ -1,9 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
public inline fun <S, T: S> Iterable<T>.reduce1(operation: (S, T) -> S): S = throw Exception()
fun test(ints: List<Int>) {
val f: () -> Unit = {
ints.reduce1 { a, b -> a + b }
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
public inline fun <S, T: S> Iterable<T>.reduce1(operation: (S, T) -> S): S = throw Exception()
@@ -1,9 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test() {
generateException(Data(1), { Data(it.x + 2) })
}
fun <T> generateException(a: T, next: (T) -> T) {}
class Data<out K>(val x: K)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun test() {
@@ -1,22 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !LANGUAGE: +NewInference
// FILE: MenuItemBase.java
public class MenuItemBase<C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> {
public String getText() { return null; }
}
// FILE: ContextMenuBase.java
public class ContextMenuBase<C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> {}
// FILE: SubMenuBase.java
public class SubMenuBase<C extends ContextMenuBase<C, I, S>, I extends MenuItemBase<C, I, S>, S extends SubMenuBase<C, I, S>> {}
// FILE: test.kt
fun test(m: MenuItemBase<*, *, *>) {
m.text
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
// !LANGUAGE: +NewInference
@@ -1,30 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS
// SKIP_TXT
// FILE: Test.java
import java.util.Collection;
public class Test {
static <T> Inv<Collection<? extends T>> bar() {
return null;
}
}
// FILE: main.kt
class Inv<E>
fun <R> foo(x: R, y: Inv<R>) {}
fun main() {
val values: List<Int> = null as List<Int>
/*
* Before the fix, there was type mismatch during checking `Test.bar()` to pass to `foo`:
* Required: Inv<List<Int>>
* Found: Inv<(MutableCollection<out Int!>..Collection<Int!>?)>
* Constraint `(MutableCollection<out T!>..Collection<T!>?)` from 'Found' (for TypeVariable(R)) has been removed
* during fixation TypeVariable(T) due to the constraint for R contained TypeVariable(T).
* The problem was that TypeVariable(T) wan't substituted due to `containsConstrainingTypeWithoutProjection` optimization.
*/
foo(values, Test.bar())
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -CAST_NEVER_SUCCEEDS
// SKIP_TXT
@@ -1,15 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
class Foo {
var test: String by refreshOnUpdate("str")
fun <T> refreshOnUpdate(initialValue: T) = RefreshDelegate(initialValue)
class RefreshDelegate<T>(initialValue: T?) {
operator fun getValue(thisRef: Foo, property: KProperty<*>): T = TODO()
operator fun setValue(thisRef: Foo, property: KProperty<*>, value: T) {}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty