FIR: Update diagnostics test data

Green code correctly became red
This commit is contained in:
Denis.Zharkov
2021-04-27 16:23:59 +03:00
committed by teamcityserver
parent 829f80179c
commit b94335dd1c
54 changed files with 101 additions and 129 deletions
@@ -20,5 +20,5 @@ fun testFunctions() {
fun testNestedCalls() {
id<String>(inferFromLambda { materialize() })
id<String>(inferFromLambda(fun() = materialize()))
id<String>(<!ARGUMENT_TYPE_MISMATCH!>inferFromLambda2(fun() = <!ARGUMENT_TYPE_MISMATCH!>materialize()<!>)<!>)
id<String>(inferFromLambda2(<!ARGUMENT_TYPE_MISMATCH!>fun() = materialize()<!>))
}
@@ -31,7 +31,7 @@ fun f1(future: OurFuture<String>, e: Either.Left<String>) {
true -> OurFuture.createOurFuture(e)
else -> throw Exception()
}
x
<!ARGUMENT_TYPE_MISMATCH!>x<!>
}
}
@@ -42,4 +42,4 @@ fun f2(future: OurFuture<String>, e: Either.Left<String>) {
else -> throw Exception()
}
}
}
}
@@ -78,11 +78,11 @@ fun main() {
// Interdependent lambdas by input-output types aren't supported
takeInterdependentLambdas({}, {})
takeInterdependentLambdas({ it }, { 10 })
takeInterdependentLambdas({ 10 }, { it })
takeInterdependentLambdas({ 10 }, { x -> x })
takeInterdependentLambdas({ x -> 10 }, { it })
takeInterdependentLambdas({ it }, { x -> 10 })
takeInterdependentLambdas({ it }, { <!ARGUMENT_TYPE_MISMATCH!>10<!> })
takeInterdependentLambdas({ <!ARGUMENT_TYPE_MISMATCH!>10<!> }, { it })
takeInterdependentLambdas({ <!ARGUMENT_TYPE_MISMATCH!>10<!> }, { x -> x })
takeInterdependentLambdas({ x -> <!ARGUMENT_TYPE_MISMATCH!>10<!> }, { it })
takeInterdependentLambdas({ it }, { x -> <!ARGUMENT_TYPE_MISMATCH!>10<!> })
// Dependent lambdas by input-output types
takeDependentLambdas({ <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>it<!> }, { it })
@@ -138,8 +138,8 @@ fun main() {
* K <: (C) -> Unit -> TypeVariable(_RP1) >: C
* K == (B) -> Unit -> TypeVariable(_RP1) == B
*/
val x17: (C) -> Unit = <!INITIALIZER_TYPE_MISMATCH!>selectB(id { <!DEBUG_INFO_EXPRESSION_TYPE("B")!>it<!> }, id { it }, id<(B) -> Unit> { x -> x })<!>
val x18: (C) -> Unit = select(id { <!DEBUG_INFO_EXPRESSION_TYPE("C")!>it<!> }, { <!DEBUG_INFO_EXPRESSION_TYPE("C")!>it<!> }, id<(B) -> Unit> { x -> x })
val x17: (C) -> Unit = <!INITIALIZER_TYPE_MISMATCH, TYPE_MISMATCH!>selectB(id <!TYPE_MISMATCH!>{ <!DEBUG_INFO_EXPRESSION_TYPE("B")!>it<!> }<!>, id <!TYPE_MISMATCH!>{ it }<!>, id<(B) -> Unit> { x -> x })<!>
val x18: (C) -> Unit = <!TYPE_MISMATCH!>select(id <!TYPE_MISMATCH!>{ <!DEBUG_INFO_EXPRESSION_TYPE("C")!>it<!> }<!>, <!TYPE_MISMATCH!>{ <!DEBUG_INFO_EXPRESSION_TYPE("C")!>it<!> }<!>, id<(B) -> Unit> { x -> x })<!>
// Resolution of extension/non-extension functions combination
val x19: String.() -> Unit = select(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.String, kotlin.Unit>")!>id { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this<!> }<!>, <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.String, kotlin.Unit>")!>id(fun(x: String) {})<!>)
@@ -149,14 +149,14 @@ fun main() {
select(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function2<kotlin.String, kotlin.String, kotlin.Unit>")!>id(fun String.(x: String) {})<!>, <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function2<kotlin.String, kotlin.String, kotlin.Unit>")!>id(fun(x: String, y: String) {})<!>)
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String -> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this<!> })
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x -> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>this<!> })
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String, y: String -> x })
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), <!TYPE_MISMATCH!>{ x: String, y: String -> x }<!>)
// Convert to extension lambda is impossible because the lambda parameter types aren't specified explicitly
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x, <!CANNOT_INFER_PARAMETER_TYPE!>y<!> -> x })
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), <!TYPE_MISMATCH!>{ x, <!CANNOT_INFER_PARAMETER_TYPE!>y<!> -> x }<!>)
select(id(id(fun(x: String, y: String) { }), <!TOO_MANY_ARGUMENTS!>fun String.(x: String) {}<!>), { x, y -> x })
val x26: Int.(String) -> Int = fun (x: String) = 10 // it must be error, see KT-38439
// Receiver must be specified in anonymous function declaration
val x27: Int.(String) -> Int = id(fun (x: String) = 10)
select(id<Int.(String) -> Unit> {}, { x: Int, y: String -> x })
val x27: Int.(String) -> Int = id(<!TYPE_MISMATCH!>fun (x: String) = 10<!>)
select(id<Int.(String) -> Unit> {}, <!TYPE_MISMATCH!>{ x: Int, y: String -> x }<!>)
// Inferring lambda parameter types by partially specified parameter types of other lambdas
select(id { x, y -> x.inv() + y.toByte() }, { x: Int, y -> y.toByte() }, { x, y: Number -> x.inv() })
@@ -218,7 +218,7 @@ fun main() {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function<kotlin.Any>")!>select({ x: Int -> TODO() }, id { x: Int, y: Number -> Any() })<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<*, kotlin.String?>")!>select(id { x: Int -> null }, id { x: String -> "" })<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function<kotlin.Int>")!>select(id { x: Int -> 10 }, id { x: Int, y: Number -> TODO() })<!>
val x68: String.(String) -> String = select(id { x: String, y: String -> "10" }, id { x: String, y: String -> "TODO()" })
val x68: String.(String) -> String = select(id <!TYPE_MISMATCH!>{ x: String, y: String -> "10" }<!>, id <!TYPE_MISMATCH!>{ x: String, y: String -> "TODO()" }<!>)
// Anonymous functions
val x69: (C) -> Unit = selectB({ it }, { }, id(fun (x) { <!DEBUG_INFO_EXPRESSION_TYPE("A")!>x<!> }))
@@ -229,7 +229,7 @@ fun main() {
val x71: String.() -> Unit = select(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.String, kotlin.Unit>")!>id(fun String.() { })<!>, <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.String, kotlin.Unit>")!>id(fun(x: String) {})<!>)
val x72: String.() -> Unit = select(fun String.() { }, fun(x: String) {}) // must be error
select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), fun (x, y) { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>x<!>;<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>y<!> })
select(id<Int.(String) -> Unit>(fun (x, y) {}), { x: Int, y: String -> x }) // receiver of anonymous function must be specified explicitly
select(id<Int.(String) -> Unit>(fun Int.(y) {}), { x: Int, y: String -> x })
select(id<Int.(String) -> Unit>(fun (x, y) {}), <!TYPE_MISMATCH!>{ x: Int, y: String -> x }<!>) // receiver of anonymous function must be specified explicitly
select(id<Int.(String) -> Unit>(fun Int.(y) {}), <!TYPE_MISMATCH!>{ x: Int, y: String -> x }<!>)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Number, java.io.Serializable>")!>select(A3(), fun (x) = "", { a -> <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number")!>a<!> })<!>
}