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,17 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
class Inv2<T, K>
fun <T, K> create(g: (T) -> K): Inv2<T, K> = TODO()
operator fun <S1, V1> Inv2<S1, V1>.getValue(o: Sample, desc: KProperty<*>): V1 = TODO()
operator fun <S2, V2> Inv2<S2, V2>.setValue(o: Sample, desc: KProperty<*>, value: V2) {}
class Version(val version: Int)
class Sample {
var version: Version by create(::Version)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -1,22 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
import kotlin.reflect.KProperty
fun test(i: Int) {
val bad by myLazyDelegate {
createSample(i) { it.toString() }
}
takeSample(bad)
}
fun <T> myLazyDelegate(i: () -> T): LazyDelegate<T> = LazyDelegate(i())
class LazyDelegate<T>(val v: T) {
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = TODO()
}
class Sample<K, V>
fun takeSample(g: Sample<Int, String>) {}
fun <T, S> createSample(i: T, a: (T) -> S): Sample<T, S> = TODO()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNUSED_PARAMETER
import kotlin.reflect.KProperty
@@ -1,14 +0,0 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
class Delegate<T>
operator fun <T> Delegate<T>.getValue(thisRef: Any?, property: kotlin.reflect.KProperty<*>): T = TODO()
fun <K> createDelegate(f: () -> K): Delegate<K> = TODO()
fun test() {
val bar: () -> String by createDelegate {
return@createDelegate { "str" }
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
@@ -1,35 +0,0 @@
package foo
import kotlin.reflect.KProperty
class A1 {
val a: String by MyProperty1()
}
class MyProperty1 {}
operator fun MyProperty1.getValue(thisRef: Any?, desc: KProperty<*>): String {
throw Exception("$thisRef $desc")
}
//--------------------
class A2 {
val a: String by MyProperty2()
}
class MyProperty2<T> {}
operator fun <T> MyProperty2<T>.getValue(thisRef: Any?, desc: KProperty<*>): T {
throw Exception("$thisRef $desc")
}
//--------------------
class A3 {
val a: String by MyProperty3()
class MyProperty3<T> {}
operator fun <T> MyProperty3<T>.getValue(thisRef: Any?, desc: KProperty<*>): T {
throw Exception("$thisRef $desc")
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package foo
import kotlin.reflect.KProperty
@@ -1,17 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
class A<E>
class B<E, F>
fun <K, V> A<K>.toB(f: (V) -> K, g: (K) -> V): B<K, V> = B()
operator fun <T1, E1> B<T1, E1>.getValue(o: Any, desc: KProperty<*>): E1 = TODO()
operator fun <T2, E2> B<T2, E2>.setValue(o: Any, desc: KProperty<*>, value: E2) {}
val q = A<String>()
class Test {
var prop by q.toB({ "abc" }, { "cde" })
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
@@ -1,29 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
val b: First by lazy {
object : First { }
}
private val withoutType by lazy {
object : First { }
}
private val withTwoSupertypes by lazy {
object : First, Second { }
}
class A<T> {
val a: First by lazy {
object : First { }
}
}
interface First
interface Second
fun <T> lazy(initializer: () -> T): Lazy<T> = TODO()
interface Lazy<out T> {
operator fun getValue(thisRef: Any?, property: KProperty<*>): T = TODO()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
@@ -1,15 +0,0 @@
// !CHECK_TYPE
import kotlin.reflect.KProperty
class A {
val a by MyProperty()
fun test() {
checkSubtype<Int>(a)
}
}
class MyProperty<R> {
operator fun getValue(thisRef: R, desc: KProperty<*>): Int = throw Exception("$thisRef $desc")
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
import kotlin.reflect.KProperty
@@ -1,76 +0,0 @@
package foo
import kotlin.reflect.KProperty
class A1 {
var a1: String by MyProperty1()
var b1: String by getMyProperty1()
}
var c1: String by getMyProperty1()
var d1: String by MyProperty1()
fun <A, B> getMyProperty1() = MyProperty1<A, B>()
class MyProperty1<R, T> {
operator fun getValue(thisRef: R, desc: KProperty<*>): T {
println("get $thisRef ${desc.name}")
throw Exception()
}
operator fun setValue(thisRef: R, desc: KProperty<*>, value: T) {
println("set $thisRef ${desc.name} $value")
}
}
//--------------------------
class A2 {
var a2: String by MyProperty2()
var b2: String by getMyProperty2()
}
var c2: String by getMyProperty2()
var d2: String by MyProperty2()
fun <A> getMyProperty2() = MyProperty2<A>()
class MyProperty2<T> {
operator fun getValue(thisRef: Any?, desc: KProperty<*>): T {
println("get $thisRef ${desc.name}")
throw Exception()
}
operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: T) {
println("set $thisRef ${desc.name} $value")
}
}
//--------------------------
class A3 {
var a3: String by MyProperty3()
var b3: String by getMyProperty3()
}
var c3: String by getMyProperty3()
var d3: String by MyProperty3()
fun <A> getMyProperty3() = MyProperty3<A>()
class MyProperty3<T> {
operator fun getValue(thisRef: T, desc: KProperty<*>): String {
println("get $thisRef ${desc.name}")
return ""
}
operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: T) {
println("set $thisRef ${desc.name} $value")
}
}
//--------------------------
fun println(a: Any?) = a
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package foo
import kotlin.reflect.KProperty
@@ -1,64 +0,0 @@
package foo
import kotlin.reflect.KProperty
class A1 {
val a1: String by MyProperty1()
val b1: String by getMyProperty1()
}
val c1: String by getMyProperty1()
val d1: String by MyProperty1()
fun <A, B> getMyProperty1() = MyProperty1<A, B>()
class MyProperty1<R, T> {
operator fun getValue(thisRef: R, desc: KProperty<*>): T {
println("get $thisRef ${desc.name}")
throw Exception()
}
}
//--------------------------
class A2 {
val a2: String by MyProperty2()
val b2: String by getMyProperty2()
}
val c2: String by getMyProperty2()
val d2: String by MyProperty2()
fun <A> getMyProperty2() = MyProperty2<A>()
class MyProperty2<T> {
operator fun getValue(thisRef: Any?, desc: KProperty<*>): T {
println("get $thisRef ${desc.name}")
throw Exception()
}
}
//--------------------------
class A3 {
val a3: String by MyProperty3()
val b3: String by getMyProperty3()
}
val c3: String by getMyProperty3()
val d3: String by MyProperty3()
fun <A> getMyProperty3() = MyProperty3<A>()
class MyProperty3<T> {
operator fun getValue(thisRef: T, desc: KProperty<*>): String {
println("get $thisRef ${desc.name}")
return ""
}
}
//--------------------------
fun println(a: Any?) = a
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package foo
import kotlin.reflect.KProperty