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,3 +0,0 @@
fun Int.rty() = 3
fun String.rty() = 4
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun Int.rty() = 3
fun String.rty() = 4
@@ -1,13 +0,0 @@
// FILE: pkg1.kt
// check no error in overload in different packages
package pkg1
fun e() = 1
// FILE: pkg2.kt
package pkg2
fun e() = 1
// FILE: pkg3pkg1.kt
package pkg3.pkg1
fun e() = 1
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: pkg1.kt
// check no error in overload in different packages
@@ -1,7 +0,0 @@
// check no error when regular function and extension function have same name
package extensionAndRegular
fun who() = 1
fun Int.who() = 1
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// check no error when regular function and extension function have same name
package extensionAndRegular
@@ -1,4 +0,0 @@
class Aaaa() {
val bb = 1
fun bb() = 1
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class Aaaa() {
val bb = 1
fun bb() = 1
@@ -1,7 +0,0 @@
fun Runnable(f: () -> Unit): Runnable = object : Runnable {
public override fun run() {
f()
}
}
val x = Runnable { }
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
fun Runnable(f: () -> Unit): Runnable = object : Runnable {
public override fun run() {
f()
@@ -1,17 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: Base.java
public interface Base {
<T> String foo(T a);
<T> int foo(T a, Object... args);
}
// FILE: Derived.java
public interface Derived extends Base {
}
// FILE: test.kt
fun testDerived(base: Base, derived: Derived) {
val test1: String = base.foo("")
val test2: String = derived.foo("")
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
// FILE: Base.java
@@ -1,28 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
object X1
object X2
interface Base {
fun <T1> foo(a: T1): X1
fun <T2> foo(a: T2, vararg args: Any): X2
}
interface Derived : Base
fun testDerived(base: Base, derived: Derived) {
val test1: X1 = base.foo("")
val test2: X1 = derived.foo("")
}
interface GenericBase<T> {
fun <T1> foo(x: T, a: T1): X1
}
interface SpecializedDerived : GenericBase<String> {
fun <T2> foo(x: String, a: T2, vararg args: Any): X2
}
fun testSpecializedDerived(derived: SpecializedDerived) {
val test1: X1 = derived.foo("", "")
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
object X1
@@ -1,14 +0,0 @@
// KT-1998 Strange "Overload resolution ambiguity"
object A {
val c : String = "test"
fun f(b: B): String {
return b.c // Test no "Overload resolution ambiguity" is reported here
}
}
class B
val B.c : String
get() = "test"
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// KT-1998 Strange "Overload resolution ambiguity"
object A {
@@ -1,17 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun withLambda(block : Int.(String) -> Unit) {
}
fun withLambda(o : Int, block : Int.(String) -> Unit) {
}
fun test() {
withLambda {
it.length
}
withLambda { r -> // no error should be here
r.length
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun withLambda(block : Int.(String) -> Unit) {
@@ -1,17 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun withLambda(block : Int.(String) -> Unit) {
}
fun withLambda(block : Int.(String, String) -> Unit) {
}
fun test() {
withLambda { r ->
r.length
}
withLambda { x, y ->
x.length + y.length
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun withLambda(block : Int.(String) -> Unit) {
@@ -1,17 +0,0 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER
// KT-7440 Cannot complete type inference if two extension functions for interface hierarchy
package inferenceagain
interface Base<T>
interface Derived<T> : Base<T>
fun <R : Comparable<R>, T : Any> Base<T>.maxBy(f: (T) -> R): T? = null
fun <R : Comparable<R>, T : Any> Derived<T>.maxBy(f: (T) -> R): T? = null
fun <T> derivedOf(vararg members: T): Derived<T> = null!!
fun <T> x(l: Derived<T>) {
derivedOf(1, 2, 3).maxBy<Int, Int> { it } // works
derivedOf(1, 2, 3).maxBy { it } // should work
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER
// KT-7440 Cannot complete type inference if two extension functions for interface hierarchy