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,8 +0,0 @@
package f
fun <T> g(i: Int, a: Any): List<T> {throw Exception()}
fun <T> g(a: Any, i: Int): Collection<T> {throw Exception()}
fun <T> test() {
val c: List<T> = <!OVERLOAD_RESOLUTION_AMBIGUITY!>g<!>(1, 1)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package f
fun <T> g(i: Int, a: Any): List<T> {throw Exception()}
@@ -1,6 +0,0 @@
package f
fun <R> h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1
fun <R> h(a: Any, i: Int, r: R, f: (Boolean) -> Int) = 1
fun test() = <!OVERLOAD_RESOLUTION_AMBIGUITY!>h<!>(1, 1, 1, { b -> 42 })
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package f
fun <R> h(i: Int, a: Any, r: R, f: (Boolean) -> Int) = 1
@@ -1,10 +0,0 @@
package f
fun <T> f(i: Int, c: Collection<T>): List<T> {throw Exception()}
fun <T> f(a: Any, l: List<T>): Collection<T> {throw Exception()}
fun <T> test(l: List<T>) {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>f<!>(1, emptyList())
}
fun <T> emptyList(): List<T> {throw Exception()}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package f
fun <T> f(i: Int, c: Collection<T>): List<T> {throw Exception()}
@@ -1,10 +0,0 @@
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
package f
fun <R> h(f: (Boolean) -> R) = 1
fun <R> h(f: (String) -> R) = 2
fun test() = <!OVERLOAD_RESOLUTION_AMBIGUITY!>h<!>{ i -> getAnswer() }
fun getAnswer() = 42
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -CONFLICTING_JVM_DECLARATIONS
package f
@@ -1,7 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun <T : Any> nullable(): T? = null
fun test() {
val value = nullable<Int>() ?: nullable()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
fun <T : Any> nullable(): T? = null
@@ -1,19 +0,0 @@
package conflictingSubstitutions
//+JDK
import java.util.*
fun <R> elemAndList(r: R, t: MutableList<R>): R = r
fun <R> R.elemAndListWithReceiver(r: R, t: MutableList<R>): R = r
fun test() {
val s = elemAndList(11, list("72"))
val u = 11.elemAndListWithReceiver(4, list("7"))
}
fun <T> list(value: T) : ArrayList<T> {
val list = ArrayList<T>()
list.add(value)
return list
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package conflictingSubstitutions
//+JDK
@@ -1,31 +0,0 @@
// SKIP_JAVAC
// FILE: MySettings.java
import java.util.Collection
class MySettings<
SS extends MySettings<SS, PS, L>,
PS extends MyComparableSettings,
L extends MySettingsListener<PS>
>
{
public Collection<PS> getLinkedProjectsSettings() {
return null;
}
public static MySettings<?, ?, ?> getSettings() {
return null;
}
}
abstract class MyComparableSettings implements Comparable<MyComparableSettings> {}
abstract class MySettingsListener<S extends MyComparableSettings> {}
// FILE: test.kt
fun test() {
val a = MySettings.getSettings()
a.getLinkedProjectsSettings()
a.linkedProjectsSettings
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_JAVAC
// FILE: MySettings.java
@@ -1,6 +0,0 @@
// NI_EXPECTED_FILE
fun <X, Y, Z> foo(f: (Y) -> Z, g: (X) -> Y, x: X): Z = f(g(x))
// TODO: Actually, this is a bug and will work when new inference is enabled
// see ([NI] Select variable with proper non-trivial constraint first) for more details
fun test() = foo({ it + 1 }, { it.length }, "")
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// NI_EXPECTED_FILE
fun <X, Y, Z> foo(f: (Y) -> Z, g: (X) -> Y, x: X): Z = f(g(x))
@@ -1,28 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
class AbstractSelector<S, I>
class SelectorFor<S>
inline operator fun <S, I> SelectorFor<S>.invoke(f: S.() -> I): AbstractSelector<S, I> = TODO()
class State(val p1: Double, val p2: () -> Int, val p3: String?)
fun test(s: SelectorFor<State>): Double {
val a = s { p1 }
a checkType { _<AbstractSelector<State, Double>>() }
val b = s { p2 }
b checkType { _<AbstractSelector<State, () -> Int>>()}
val c = s { p3 }
c checkType { _<AbstractSelector<State, String?>>() }
val d = s { }
d checkType { _<AbstractSelector<State, Unit>>() }
val e = s { return p1 }
e checkType { _<AbstractSelector<State, Nothing>>() }
return null!!
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
@@ -1,11 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
fun <K> select2(x: K, y: K): K = TODO()
fun <K> select3(x: K, y: K, z: K): K = TODO()
fun test2(f: ((String) -> Int)?) {
val a0: ((Int) -> Int)? = select2({ it -> it }, null)
val b0: ((Nothing) -> Unit)? = select2({ it -> it }, null)
select3({ it.length }, f, null)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
fun <K> select2(x: K, y: K): K = TODO()
@@ -1,33 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
interface First {
fun first() {}
}
interface Second
interface Third
interface Fourth
fun chained1(arg: First) = run {
if (arg !is Second) throw Exception()
arg
}.let { third ->
if (third !is Third) throw Exception()
third
}
fun chained2(arg: First) = run {
if (arg !is Second) throw Exception()
arg
}.let { third ->
if (third !is Third) throw Exception()
third
}.let { fourth ->
if (fourth !is Fourth) throw Exception()
fourth
}
fun test(arg: First) {
chained1(arg).<!UNRESOLVED_REFERENCE!>first<!>()
chained2(arg).<!UNRESOLVED_REFERENCE!>first<!>()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
@@ -1,21 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
interface Base {
fun base() {}
}
interface Base2
interface One : Base, Base2
interface Two : Base, Base2
fun <S: Base> intersectNullable(vararg elements: S): S? = TODO()
fun smartCastAfterIntersection(a: One, b: Two) = run {
val v = intersectNullable(a, b)
if (v == null) throw Exception()
v
}
fun test(one: One, two: Two) {
smartCastAfterIntersection(one, two)<!UNNECESSARY_SAFE_CALL!>?.<!><!UNRESOLVED_REFERENCE!>base<!>()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
@@ -1,24 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
interface Base {
fun base() {}
}
interface Base2 : Base3
interface Base3
interface One : Base, Base2
interface Two : Base, Base2
interface Three : Base, Base3
object O1 : One
object O2 : Two
object O3 : Three
fun <S: Base> intersect(vararg elements: S): S = TODO()
fun <S> intersectNoBound(vararg elements: S): S = TODO()
fun some(a: One, b: Two, c: Three) = intersectNoBound(intersect(a, b), c)
fun test(arg: Base, arg2: Base) {
some(O1, O2, O3).<!UNRESOLVED_REFERENCE!>base<!>()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// NI_EXPECTED_FILE
@@ -1,18 +0,0 @@
// !DIAGNOSTICS: -UNREACHABLE_CODE
//KT-2838 Type inference failed on passing null as a nullable argument
package a
fun <T> foo(a: T, b: Map<T, String>?) = b?.get(a)
fun <T> bar(a: T, b: Map<T, String>) = b.get(a)
fun test(a: Int) {
foo(a, null)
bar(a, <!NULL_FOR_NONNULL_TYPE!>null<!>)
}
fun test1(a: Int) {
foo(a, throw Exception())
}
fun test2(a: Int) {
bar(a, throw Exception())
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNREACHABLE_CODE
//KT-2838 Type inference failed on passing null as a nullable argument
package a
@@ -1,34 +0,0 @@
// !CHECK_TYPE
package s
import checkSubtype
interface In<in T>
interface A
interface B
interface C: A, B
fun <T> foo(in1: In<T>, in2: In<T>): T = throw Exception("$in1 $in2")
fun test(inA: In<A>, inB: In<B>, inC: In<C>) {
foo(inA, inB)
val r = foo(inA, inC)
checkSubtype<C>(r)
val c: C = foo(inA, inB)
use(c)
}
fun <T: C> bar(in1: In<T>): T = throw Exception("$in1")
fun test(inA: In<A>) {
val r = bar(inA)
checkSubtype<C>(r)
}
fun use(vararg a: Any?) = a
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
package s