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 @@
class My(val x: Int) {
val y: Int = x + 3
val z: Int? = foo()
fun foo() = if (x >= 0) x else if (y >= 0) y else null
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class My(val x: Int) {
val y: Int = x + 3
val z: Int? = foo()
@@ -1,13 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
class Delegate(val x: Int) {
operator fun getValue(t: Any?, p: KProperty<*>): Int = x
}
class My {
val x: Int by Delegate(this.foo())
fun foo(): Int = x
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
@@ -1,20 +0,0 @@
private const val A = 0L
private val B = 0L
private fun sample() = 0L
private class PrivateClass
class Foo {
var bar: Long = 0
private var other: PrivateClass? = null
init {
bar = A
bar = B
bar = sample()
other = PrivateClass()
}
constructor()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
private const val A = 0L
private val B = 0L
@@ -1,18 +0,0 @@
interface Wise {
fun doIt(): Int
}
fun Wise(f: () -> Int) = object: Wise {
override fun doIt() = f()
}
class My {
// Still dangerous (???), nobogy can guarantee what Wise() will do with this lambda
val x = Wise { foo() }
val y = 42
fun foo() = y
fun bar() = x.doIt()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface Wise {
fun doIt(): Int
}
@@ -1,15 +0,0 @@
class WithLateInit {
lateinit var x: String
fun init(xx: String) {
x = xx
}
init {
// This is obviously a bug,
// but with lateinit we explicitly want it to occur in runtime
use()
}
fun use() = x
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class WithLateInit {
lateinit var x: String
@@ -1,19 +0,0 @@
open class Wise {
val x = 1
open fun doIt(): Int = 42
}
class My {
fun foo(): Int {
val wise = object: Wise() {
var xx = 1
override fun doIt() = super.doIt() + bar(this) + xx
}
return wise.doIt()
}
}
fun bar(wise: Wise): Int = wise.x
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
open class Wise {
val x = 1
@@ -1,12 +0,0 @@
class My {
val x: Int
get() = 1
init {
// x has no backing field, so the call is safe
foo()
}
fun foo() {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class My {
val x: Int
@@ -1,11 +0,0 @@
class Outer {
fun foo() = 1
inner class Inner {
val x = this@Outer.foo()
val y = foo()
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Outer {
fun foo() = 1
@@ -1,7 +0,0 @@
class My {
val x: Int
constructor(x: Int) {
this.x = x
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class My {
val x: Int