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,36 +0,0 @@
import java.util.Enumeration
fun <T> java.util.Enumeration<T>.iterator() = object: Iterator<T> {
override fun hasNext(): Boolean = hasMoreElements()
override fun next() = nextElement()
}
interface MyIterator<T> {
operator fun hasNext() : Boolean
operator fun next() : T
}
operator fun <T : Any> T?.iterator() = object : MyIterator<T> {
var hasNext = this@iterator != null
private set
override fun hasNext() = hasNext
override fun next() : T {
if (hasNext) {
hasNext = false
return this@iterator!!
}
throw java.util.NoSuchElementException()
}
}
fun main() {
val i : Int? = 1
for (x in i) {
System.out.println(x)
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
import java.util.Enumeration
fun <T> java.util.Enumeration<T>.iterator() = object: Iterator<T> {
@@ -1,19 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !WITH_NEW_INFERENCE
interface JPAEntityClass<D> {
fun <T> T.findByName(s: String): D {null!!}
}
class Foo {
companion object : JPAEntityClass<Foo>
}
fun main() {
with("", {
Foo.<!UNRESOLVED_REFERENCE!>findByName<!>("")
})
with(Foo) {
findByName("")
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !WITH_NEW_INFERENCE
@@ -1,8 +0,0 @@
val Int.foo: Int
get() = this
fun test(foo: Int) {
test(4.foo)
test(foo)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
val Int.foo: Int
get() = this
@@ -1,15 +0,0 @@
//KT-2317 Wrong UNNECESSARY_SAFE_CALL
package kt2317
fun Any?.baz() = 1
fun foo(l: Long?) = l?.baz()
fun Any?.bar(): Unit { }
fun quux(x: Int?): Unit {
x?.baz()
x?.bar()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
//KT-2317 Wrong UNNECESSARY_SAFE_CALL
package kt2317
@@ -1,7 +0,0 @@
class A {
companion object {
fun foo() = toString()
}
}
val a = A.toString()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
companion object {
fun foo() = toString()
@@ -1,11 +0,0 @@
// FILE: A.java
public class A {
public static void foo() {}
public static class Nested {}
}
// FILE: B.kt
fun Any?.bar() = 42
fun f1() = A.<!UNRESOLVED_REFERENCE!>bar<!>()
fun f2() = A.Nested.<!UNRESOLVED_REFERENCE!>bar<!>()
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: A.java
public class A {
public static void foo() {}
@@ -1,6 +0,0 @@
object O
fun Any.foo() = 42
val Any?.bar: Int get() = 239
val x = O.foo() + O.bar
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
object O
fun Any.foo() = 42