[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun <T, R> Iterable<T>.map(transform: (T) -> R): List<R> = null!!
|
||||
|
||||
fun autolabel(l: List<Int>) = l.map (fun (i: Int): Int {
|
||||
return@map 4
|
||||
})
|
||||
|
||||
fun unresolvedMapLabel(l: List<Int>) = l.map (l@ fun(i: Int): Int {
|
||||
return@map 4
|
||||
})
|
||||
@@ -0,0 +1,19 @@
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
annotation class ann(val name: String)
|
||||
const val ok = "OK"
|
||||
|
||||
class A
|
||||
|
||||
val withoutName = fun () {}
|
||||
val extensionWithoutName = fun A.() {}
|
||||
|
||||
fun withAnnotation() = @ann(ok) fun () {}
|
||||
val withReturn = fun (): Int { return 5}
|
||||
val withExpression = fun() = 5
|
||||
val funfun = fun() = fun() = 5
|
||||
|
||||
val parentesized = (fun () {})
|
||||
val parentesizedWithType = checkSubtype<() -> Unit>((fun () {}))
|
||||
val withType = checkSubtype<() -> Unit>((fun () {}))
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
|
||||
|
||||
fun <T> foo(f : (T) -> T) : T = throw Exception()
|
||||
|
||||
fun test() {
|
||||
val a : Int = foo(fun (x) = x)
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
fun test() {
|
||||
fun bar() {
|
||||
val bas = fun() {
|
||||
return@bar
|
||||
}
|
||||
}
|
||||
|
||||
val bar = fun() {
|
||||
return@test
|
||||
}
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
val bal = bag@ fun () {
|
||||
val bar = fun() {
|
||||
return@bag
|
||||
}
|
||||
return@bag
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun testReturnType(foo: String) {
|
||||
val bar = fun () = foo
|
||||
|
||||
bar.checkType { _<() -> String>() }
|
||||
|
||||
val bas: () -> String = fun () = foo
|
||||
|
||||
val bag: () -> Int = fun () = foo
|
||||
}
|
||||
|
||||
fun testParamType() {
|
||||
val bar = fun (bal: String){}
|
||||
|
||||
bar.checkType { _<(String) -> Unit>() }
|
||||
|
||||
val bas: (String) -> Unit = fun (param: String) {}
|
||||
val bag: (Int) -> Unit = fun (param: String) {}
|
||||
}
|
||||
|
||||
fun testReceiverType() {
|
||||
val bar = fun String.() {}
|
||||
|
||||
bar.checkType { _<String.() -> Unit>() }
|
||||
|
||||
val bas: String.() -> Unit = fun String.() {}
|
||||
|
||||
val bag: Int.() -> Unit = fun String.() {}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
fun <T> listOf(): List<T> = null!!
|
||||
|
||||
fun test(a: (Int) -> Int) {
|
||||
test(fun (x) = 4)
|
||||
|
||||
test(fun (x) = x)
|
||||
|
||||
test(fun (x): Int { checkSubtype<Int>(x); return 4 })
|
||||
}
|
||||
|
||||
fun test2(a: () -> List<Int>) {
|
||||
test2(fun () = listOf())
|
||||
}
|
||||
|
||||
val a: (Int) -> Unit = fun(x) { checkSubtype<Int>(x) }
|
||||
|
||||
val b: (Int) -> Unit = fun(x: String) {}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !CHECK_TYPE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
val a = fun (x) = x
|
||||
|
||||
val b: (Int) -> Int = fun (x) = x + 3
|
||||
|
||||
val c: (Int, String) -> Int = fun (x) = 3
|
||||
|
||||
val d: (Int, String) -> Int = fun (x) = 3
|
||||
|
||||
val e: (Int, String) -> Int = fun (x: String) = 3
|
||||
|
||||
val f: (Int) -> Int = fun (x: String) = 3
|
||||
|
||||
fun test1(a: (Int) -> Unit) {
|
||||
test1(fun (x) { checkSubtype<Int>(x)})
|
||||
}
|
||||
|
||||
fun test2(a: (Int) -> Unit) {
|
||||
<!INAPPLICABLE_CANDIDATE!>test2<!>(fun (x: String) {})
|
||||
}
|
||||
|
||||
fun test3(a: (Int, String) -> Unit) {
|
||||
<!INAPPLICABLE_CANDIDATE!>test3<!>(fun (x: String) {})
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun foo() {
|
||||
class A
|
||||
fun bar() {}
|
||||
(fun bar() {})
|
||||
fun A.foo() {}
|
||||
(fun A.foo() {})
|
||||
|
||||
run(<!INFERENCE_ERROR!>fun foo() {}<!>)
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
val bar = fun() {}
|
||||
val bas = fun() {}
|
||||
|
||||
fun gar(p: Any?) = fun() {}
|
||||
fun gas(p: Any?) = fun() {}
|
||||
|
||||
fun outer() {
|
||||
val bar = fun() {}
|
||||
val bas = fun() {}
|
||||
|
||||
fun gar(p: Any?) = fun() {}
|
||||
fun gas(p: Any?) = fun() {}
|
||||
|
||||
gar(fun() {})
|
||||
gar(fun() {})
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
val bar = fun(p: Int = 3) {}
|
||||
val bas = fun(vararg p: Int) {}
|
||||
|
||||
fun gar() = fun(p: Int = 3) {}
|
||||
fun gas() = fun(vararg p: Int) {}
|
||||
|
||||
fun outer(b: Any?) {
|
||||
val bar = fun(p: Int = 3) {}
|
||||
val bas = fun(vararg p: Int) {}
|
||||
|
||||
fun gar() = fun(p: Int = 3) {}
|
||||
fun gas() = fun(vararg p: Int) {}
|
||||
|
||||
outer(fun(p: Int = 3) {})
|
||||
outer(fun(vararg p: Int) {})
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
fun foo(f: String.() -> Int) {}
|
||||
val test = foo(fun () = <!UNRESOLVED_REFERENCE!>length<!>)
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
val label_fun = label@ fun () {
|
||||
return@label
|
||||
}
|
||||
|
||||
val parenthesized_label_fun = (label@ fun () {
|
||||
return@label
|
||||
})
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
val foo = fun(a: Int): String {
|
||||
if (a == 1) return "4"
|
||||
when (a) {
|
||||
5 -> return "2"
|
||||
3 -> return null
|
||||
2 -> return 2
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
interface B {
|
||||
fun b_fun() {}
|
||||
}
|
||||
|
||||
fun test(param: String) {
|
||||
|
||||
val local_val = 4
|
||||
val bar = fun B.(fun_param: Int) {
|
||||
param.length
|
||||
<!UNRESOLVED_REFERENCE!>b_fun<!>()
|
||||
val inner_bar = local_val + fun_param
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
}
|
||||
|
||||
<!UNRESOLVED_REFERENCE!>inner_bar<!>
|
||||
<!UNRESOLVED_REFERENCE!>fun_param<!>
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER
|
||||
|
||||
interface A
|
||||
fun devNull(a: Any?){}
|
||||
|
||||
val generic_fun = fun<T>(t: T): T = null!!
|
||||
val extension_generic_fun = fun<T>T.(t: T): T = null!!
|
||||
|
||||
fun fun_with_where() = fun <T> T.(t: T): T where T: A = null!!
|
||||
|
||||
|
||||
fun outer() {
|
||||
devNull(fun <T>() {})
|
||||
devNull(fun <T> T.() {})
|
||||
devNull(fun <T> (): T = null!!)
|
||||
devNull(fun <T> (t: T) {})
|
||||
devNull(fun <T> () where T:A {})
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
fun <T> parameter() = fun (t: T) = t
|
||||
fun <T> receiver() = fun T.() = this
|
||||
fun <T> returnType() = fun (): T = null!!
|
||||
|
||||
val <T> T.fromVal: () -> T get() = fun (): T = this@fromVal
|
||||
|
||||
fun devNull(a: Any?){}
|
||||
|
||||
fun <O> outer() {
|
||||
fun <T> parameter() = fun (t: T) = t
|
||||
fun <T> receiver() = fun T.() = this
|
||||
fun <T> returnType() = fun (): T = null!!
|
||||
|
||||
devNull(fun (t: O) = t)
|
||||
devNull(fun O.() = this)
|
||||
devNull(fun (): O = null!!)
|
||||
}
|
||||
|
||||
class Outer<O> {
|
||||
fun <T> parameter() = fun (t: T) = t
|
||||
fun <T> receiver() = fun T.() = this
|
||||
fun <T> returnType() = fun (): T = null!!
|
||||
|
||||
init {
|
||||
devNull(fun (t: O) = t)
|
||||
devNull(fun O.() = this)
|
||||
devNull(fun (): O = null!!)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
annotation class ann
|
||||
val bas = fun ()
|
||||
|
||||
fun bar(a: Any) = fun ()
|
||||
|
||||
fun outer() {
|
||||
bar(fun ())
|
||||
bar(l@ fun ())
|
||||
bar(@ann fun ())
|
||||
}
|
||||
Reference in New Issue
Block a user