[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
companion object {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun use(vararg a: Any?) = a
|
||||
|
||||
fun test() {
|
||||
use(use(A, null).toString())
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package c
|
||||
|
||||
fun test() {
|
||||
with (1) l@ {
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(1, zz = { this@l } )
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(x: Int) = x
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
interface Foo<T>
|
||||
|
||||
class Bar {
|
||||
operator fun <T> invoke(): Foo<T> = throw Exception()
|
||||
}
|
||||
|
||||
class A {
|
||||
val bar = Bar()
|
||||
}
|
||||
|
||||
fun fooInt(l: Foo<Int>) = l
|
||||
|
||||
fun test(bar: Bar, a: A) {
|
||||
// no elements with error types
|
||||
fooInt((bar()))
|
||||
fooInt(if (true) bar() else bar())
|
||||
fooInt(label@ bar())
|
||||
fooInt(a.bar())
|
||||
fooInt(((label@ if (true) (a.bar()) else bar())))
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
package h
|
||||
|
||||
fun foo(i: Int) = i
|
||||
fun foo(s: String) = s
|
||||
|
||||
fun test() {
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(emptyList())
|
||||
}
|
||||
|
||||
fun <T> emptyList(): List<T> {throw Exception()}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package c
|
||||
|
||||
fun zzz(i: Int, f: (Int) -> Int) { throw Exception("$i $f")}
|
||||
|
||||
fun test() {
|
||||
fun foo(): Int = 42
|
||||
|
||||
fun bar(i: Int) = i
|
||||
|
||||
bar(<!INAPPLICABLE_CANDIDATE!>foo<!>(xx = zzz(11) { j: Int -> j + 7 }))
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(zz = <!INAPPLICABLE_CANDIDATE!>foo<!>(
|
||||
xx = zzz(12) { i: Int -> i + i }))
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
//KT-5971 Missing error when fun argument is safe call
|
||||
|
||||
fun foo(i: Int) {}
|
||||
|
||||
fun test(s: String?) {
|
||||
foo(s?.length)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
interface Inv<I>
|
||||
|
||||
fun <S, T: S> Inv<T>.reduce2(): S = null!!
|
||||
|
||||
fun test(a: Inv<Int>): Int {
|
||||
val b = 1 + a.reduce2()
|
||||
return b
|
||||
}
|
||||
compiler/testData/diagnostics/tests/resolve/nestedCalls/manyInapplicableCandidatesWithLambdas.fir.kt
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class A
|
||||
class B
|
||||
class C
|
||||
class D
|
||||
|
||||
fun A.bar(x: Int = 0) = ""
|
||||
fun A.bar(x: Int = 0, y: D.() -> Unit) = ""
|
||||
|
||||
fun B.bar(x: Int = 0) = ""
|
||||
fun B.bar(x: Int = 0, y: D.() -> Unit) = ""
|
||||
|
||||
fun C.bar(x: Int = 0) = ""
|
||||
fun C.bar(x: Int = 0, y: D.() -> Unit) = ""
|
||||
|
||||
class E {
|
||||
fun foo() {
|
||||
// `bar` calls are inapplicable since both E nor D aren't proper receivers
|
||||
// But prior to this change, every lambda was analyzed repeatedly for every candidate
|
||||
// Thus, the resulting time was exponential
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
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))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user