FIR: Mark a pack of tests (53) as FIR_IDENTICAL

This commit is contained in:
Denis.Zharkov
2021-05-24 13:01:57 +03:00
committed by teamcityserver
parent ddbdfafa79
commit dac9d7b17a
106 changed files with 53 additions and 1057 deletions
@@ -1,10 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun Int.invoke(i: Int, a: Any) {}
fun Int.invoke(a: Any, i: Int) {}
fun foo(i: Int) {
<!NONE_APPLICABLE!>i<!>(1, 1)
<!NONE_APPLICABLE!>5<!>(1, 2)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun Int.invoke(i: Int, a: Any) {}
@@ -1,22 +0,0 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A
fun test(foo: A.() -> Int, a: A) {
val b: Int = foo(a)
val c: Int = (foo)(a)
}
class B {
val foo: A.() -> Int = null!!
init {
val b: Int = foo(A())
}
}
fun foo(): A.() -> Int {
val b: Int = foo()(A())
val c: Int = (foo())(A())
return null!!
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A
@@ -1,18 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A
class B : A
val String.ext: A
get() = TODO()
class Cls {
fun take(arg: B) {}
fun test(s: String) {
if (s.ext is B)
take(s.ext)
}
}
fun take(arg: Any) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A
@@ -1,10 +0,0 @@
package h
fun foo(i: Int) = i
fun foo(s: String) = s
fun test() {
<!NONE_APPLICABLE!>foo<!>(emptyList())
}
fun <T> emptyList(): List<T> {throw Exception()}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package h
fun foo(i: Int) = i
@@ -1,16 +0,0 @@
class ResolutionCandidate<A>
class ResolutionTask<B, C : B>(val candidate: ResolutionCandidate<B>)
fun <D, E : D> List<ResolutionTask<D, E>>.bar(t: ResolutionTask<D, E>) = t
public class ResolutionTaskHolder<F, G : F> {
fun test(candidate: ResolutionCandidate<F>, tasks: MutableList<ResolutionTask<F, G>>) {
tasks.bar(ResolutionTask<F, G>(candidate))
tasks.add(ResolutionTask<F, G>(candidate))
//todo the problem is the type of ResolutionTask is inferred as ResolutionTask<F, F> too early
tasks.bar(ResolutionTask(candidate))
tasks.add(ResolutionTask(candidate))
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class ResolutionCandidate<A>
class ResolutionTask<B, C : B>(val candidate: ResolutionCandidate<B>)
@@ -1,19 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A<T> {
fun foo(x: T)
fun foo(x: String)
fun <E> baz(x: E, y: String)
fun <E> baz(x: String, y: E)
}
fun <E> baz(x: E, y: String) {}
fun <E> baz(x: String, y: E) {}
fun bar(x: A<String>) {
x.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>("")
x.<!OVERLOAD_RESOLUTION_AMBIGUITY!>baz<!>("", "")
<!OVERLOAD_RESOLUTION_AMBIGUITY!>baz<!>("", "")
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A<T> {
@@ -1,9 +0,0 @@
interface AutoCloseable
interface Closeable : AutoCloseable
fun <T1 : AutoCloseable, R1> T1.myUse(f: (T1) -> R1): R1 = f(this)
fun <T2 : Closeable, R2> T2.myUse(f: (T2) -> R2): R2 = f(this)
fun test1(x: Closeable) = x.myUse { 42 }
fun test2(x: Closeable) = x.myUse<Closeable, Int> { 42 }
fun test3(x: Closeable) = x.myUse<AutoCloseable, Int> { 42 } // TODO KT-10681
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface AutoCloseable
interface Closeable : AutoCloseable
@@ -1,15 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
open class A<T>(val value: T)
class B<T>(value: T) : A<T>(value)
fun <T> A<T>.foo(block: (T?) -> Unit) {
block(value)
}
fun <T> B<T>.foo(block: (T) -> Unit) {
block(value)
}
fun main() {
B("string").<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> { }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
open class A<T>(val value: T)
@@ -1,25 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
enum class A { A1 }
fun <T : Enum<T>> foo(arg: T.() -> Unit) = 1
// FILE: b.kt
package b
fun <T : Any> foo(arg: T.() -> Unit) = 2
// FILE: test.kt
import a.*
import b.*
fun test() {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!><A> { }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -1,23 +0,0 @@
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: a.kt
package a
fun <T> foo(block: (T?) -> Unit) {}
// FILE: b.kt
package b
fun <K> foo(block: (K) -> Unit) {}
// FILE: test.kt
import a.*
import b.*
fun main() {
foo<String> { }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CONSTRAINT_SYSTEM_FOR_OVERLOAD_RESOLUTION: CONSTRAINT_SYSTEM_FOR_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER
@@ -1,28 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
interface A
interface B
interface C: A, B
interface D: A, B
interface E: A, B
fun foo(c: C?, d: D?, e: E?) {
val test1: A? = c ?: d ?: e
val test2: B? = if (false) if (true) c else d else e
val test3: A? = when {
true -> c
else -> when {
true -> d
else -> e
}
}
val test4: B? = when (1) {
1 -> c
2 -> d
else -> e
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
interface A