From a0f8ada285a8cabdba1dcc3f690b2ed89fd6247c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 6 Jul 2020 10:49:04 +0300 Subject: [PATCH] [FIR-TEST] Unmute failing diagnostic tests --- .../postponedArgumentsAnalysis/basic.fir.fail | 11 --- .../postponedArgumentsAnalysis/basic.fir.kt | 90 +++++++++---------- .../callableReferences.fir.fail | 8 -- .../callableReferences.fir.kt | 28 +++--- .../suspendFunctions.fir.fail | 8 -- .../suspendFunctions.fir.kt | 20 ++--- 6 files changed, 69 insertions(+), 96 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.fail delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.fail delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.fail diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.fail b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.fail deleted file mode 100644 index 6de8440105e..00000000000 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.fail +++ /dev/null @@ -1,11 +0,0 @@ -Failures detected in FirBodyResolveTransformerAdapter, file: /basic.fir.kt -Cause: java.lang.RuntimeException: While resolving call R?C|/selectFloat|(R?C|/id|( = id@fun .(): { - ^@id Unit -} -), R?C|/id|( = id@fun .(x: ): { - ^@id Unit -} -), R?C|/id|( = id@fun .(): { - it# -} -)) diff --git a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt index 27c25ec6bf0..0c02db8753d 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/postponedArgumentsAnalysis/basic.fir.kt @@ -32,59 +32,59 @@ fun test1() { baz1(id(::foo), id<(Int) -> Unit>(id(::foo))) baz1(id { it.inv() }, id<(Int) -> Unit> { }) - baz1(id1 { x -> x.inv() }, id2 { x: Int -> }) - baz1(id1 { it.inv() }, id2 { x: Int -> }) + baz1(id1 { x -> x.inv() }, id2 { x: Int -> }) + baz1(id1 { it.inv() }, id2 { x: Int -> }) - baz2(id1 { it.inv() }, id2(Inv { x: Int -> })) + baz2(id1 { it.inv() }, id2(Inv { x: Int -> })) - select(id1 { it.inv() }, id1 { x: Number -> TODO() }, id1(id2 { x: Int -> x })) + select(id1 { it.inv() }, id1 { x: Number -> TODO() }, id1(id2 { x: Int -> x })) - select(id1 { it.inv() }, id1 { x: Number -> TODO() }, id1(id2(::foo2))) - select(id1 { x: Inv -> TODO() }, id1 { ")!>it.x.inv() }, id1 { x: Inv -> TODO() }) + select(id1 { it.inv() }, id1 { x: Number -> TODO() }, id1(id2(::foo2))) + select(id1 { x: Inv -> TODO() }, id1 { it.x.inv() }, id1 { x: Inv -> TODO() }) - select(id1 { & Inv}")!>it }, id1 { x: Inv -> TODO() }, id1 { x: Inv -> TODO() }) + select(id1 { it }, id1 { x: Inv -> TODO() }, id1 { x: Inv -> TODO() }) ")!>select(id1(::foo), id(::foo3), id1(id2(::foo2))) - select({ it }, { x: Int -> TODO() }) + select({ it }, { x: Int -> TODO() }) // Interdependent postponed arguments are unsupported - takeInterdependentLambdas({}, {}) - takeInterdependentLambdas({ it }, { 10 }) - takeInterdependentLambdas({ 10 }, { it }) - takeInterdependentLambdas({ 10 }, { x -> x }) - takeInterdependentLambdas({ x -> 10 }, { it }) - takeInterdependentLambdas({ it }, { x -> 10 }) + takeInterdependentLambdas({}, {}) + takeInterdependentLambdas({ it }, { 10 }) + takeInterdependentLambdas({ 10 }, { it }) + takeInterdependentLambdas({ 10 }, { x -> x }) + takeInterdependentLambdas({ x -> 10 }, { it }) + takeInterdependentLambdas({ it }, { x -> 10 }) takeDependentLambdas({ it }, { it }) takeDependentLambdas({ it.length }, { "it" }) takeDependentLambdas({ it; 10 }, { }) - select({ it }, fun(x: Int) = 1) + select({ it }, fun(x: Int) = 1) val x5: (Int) -> Unit = select({ it }, { x: Number -> Unit }) val x6 = select(id { it }, id(id<(Int) -> Unit> { x: Number -> Unit })) - select(id(id2 { it.inv() }), id(id { x: Int -> x })) + select(id(id2 { it.inv() }), id(id { x: Int -> x })) val x7: (Int) -> Unit = selectNumber(id {}, id {}, id {}) val x8: (Int) -> Unit = selectNumber(id { x -> x }, id { x -> }, id { x -> }) val x9: (Int) -> Unit = selectNumber(id { }, id { x -> }, id { it }) - val x10: (Int) -> Unit = selectFloat(id { }, id { x -> }, id { & Number}")!>it }) + val x10: (Int) -> Unit = selectFloat(id { }, id { x -> }, id { it }) - val x11: (B) -> Unit = selectC(id { }, id { x -> x }, id { it }) + val x11: (B) -> Unit = selectC(id { }, id { x -> x }, id { it }) /* * Upper constraint is less specific than lower (it's error): * K <: (A) -> Unit -> TypeVariable(_RP1) >: A * K >: (C) -> TypeVariable(_R) -> TypeVariable(_RP1) <: C */ - val x12 = selectC(id { it }, id { x: B -> }) - val x13 = selectA(id { it }, id { x: C -> }) + val x12 = selectC(id { it }, id { x: B -> }) + val x13 = selectA(id { it }, id { x: C -> }) // one upper constraint and one lower - val x14 = selectC(id { it }, id { x: A -> }, { x -> x }) + val x14 = selectC(id { it }, id { x: A -> }, { x -> x }) val x15 = selectC(id { it }, { x: A -> }, id { x -> x }) /* @@ -94,42 +94,42 @@ fun test1() { * K >: (A) -> TypeVariable(_R) -> TypeVariable(_RP1) <: A * K == intersect(CST(C, B), A) == A */ - val x16: (C) -> Unit = selectB(id { it }, { x -> }, id { x: A -> x }) + val x16: (C) -> Unit = selectB(id { it }, { x -> }, id { x: A -> x }) /* * two upper constraints and one equality (it's error) * K <: (C) -> Unit -> TypeVariable(_RP1) >: C * K == (B) -> Unit -> TypeVariable(_RP1) == B */ - val x17: (C) -> Unit = selectB(id { it }, id { it }, id<(B) -> Unit> { x -> x }) - val x18: (C) -> Unit = select(id { it }, { it }, id<(B) -> Unit> { x -> x }) + val x17: (C) -> Unit = selectB(id { it }, id { it }, id<(B) -> Unit> { x -> x }) + val x18: (C) -> Unit = select(id { it }, { it }, id<(B) -> Unit> { x -> x }) - val x19: String.() -> Unit = select( kotlin.Unit")!>id {}, kotlin.Unit")!>id(fun(x: String) {})) - val x20: String.() -> Unit = select( kotlin.Unit")!>{}, kotlin.Unit")!>(fun(x: String) {})) - val x21: String.() -> Unit = select( kotlin.Unit")!>id(fun(x: String) {}), kotlin.Unit")!>id(fun(x: String) {})) - val x22 = select(id Unit>(fun(x: String) {}), kotlin.Unit")!>id(fun(x: String) {})) - val x23 = select( kotlin.Unit")!>id(fun String.(x: String) {}), kotlin.Unit")!>id(fun(x: String, y: String) {})) + val x19: String.() -> Unit = select(")!>id {}, ")!>id(fun(x: String) {})) + val x20: String.() -> Unit = select(")!>{}, (fun(x: String) {})) + val x21: String.() -> Unit = select(")!>id(fun(x: String) {}), ")!>id(fun(x: String) {})) + val x22 = select(id Unit>(fun(x: String) {}), ")!>id(fun(x: String) {})) + val x23 = select(")!>id(fun String.(x: String) {}), ")!>id(fun(x: String, y: String) {})) val x24 = select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String -> this }) val x25 = select(id(fun String.(x: String) {}), id(fun(x: String, y: String) { }), { x: String, y: String -> x }) // It isn't related with posponed arguments, see KT-38439 val x26: Int.(String) -> Int = fun (x: String) = 10 - val x27: Int.(String) -> Int = id(fun (x: String) = 10) + val x27: Int.(String) -> Int = id(fun (x: String) = 10) - val x28 = select(id { x, y -> x.inv() + y.toByte() }, { x: Int, y -> y.toByte() }, { x, y: Number -> x.inv() }) - val x29 = select(id { x, y -> x.inv() + y.toByte() }, id { x: Int, y -> y.toByte() }, id { x, y: Number -> x.inv() }) - val x30 = select({ x, y -> x.inv() + y.toByte() }, id { x: Int, y -> y.toByte() }, id { x, y: Number -> x.inv() }) + val x28 = select(id { x, y -> x.inv() + y.toByte() }, { x: Int, y -> y.toByte() }, { x, y: Number -> x.inv() }) + val x29 = select(id { x, y -> x.inv() + y.toByte() }, id { x: Int, y -> y.toByte() }, id { x, y: Number -> x.inv() }) + val x30 = select({ x, y -> x.inv() + y.toByte() }, id { x: Int, y -> y.toByte() }, id { x, y: Number -> x.inv() }) val x31 = select( id { x, y -> x.inv() + y.toByte() }, id<(Int, Number) -> Int> { x, y -> x.inv() }, - {} as (Number, Number) -> Int + {} as (Number, Number) -> Int ) val x32 = selectPosponedArgument({ it }, { x: Int -> }, { x: Nothing -> x }) - val x33 = selectPosponedArgument({ it }, { } as (Int) -> Unit, { x: Nothing -> x }) - val x34 = selectPosponedArgument({ it }, { } as (Nothing) -> Unit, { x: Int -> x }) - val x35 = selectPosponedArgument({ it }, { } as (Int) -> Unit, { } as (Nothing) -> Unit) + val x33 = selectPosponedArgument({ it }, { } as (Int) -> Unit, { x: Nothing -> x }) + val x34 = selectPosponedArgument({ it }, { } as (Nothing) -> Unit, { x: Int -> x }) + val x35 = selectPosponedArgument({ it }, { } as (Int) -> Unit, { } as (Nothing) -> Unit) val x36 = selectPosponedArgument3({ it }, { it }, { x: Int -> x }) val x37 = selectPosponedArgument3({ it }, { x: Number -> x }, { x: Int -> x }) @@ -138,24 +138,24 @@ fun test1() { val x40 = select(id Unit> {}, { x: Int, y: String -> x }) - val x41 = select(A2(), { a, b, c -> a; b; c }) - val x42 = select(A3(), { it }, { a -> a }) + val x41 = select(A2(), { a, b, c -> a; b; c }) + val x42 = select(A3(), { it }, { a -> a }) val x43 = select(A3(), ")!>A3::foo1) - val x44 = select(A3(), ")!>A3::foo1, { a -> a }, { it -> it }) + val x44 = select(A3(), ")!>A3::foo1, { a -> a }, { it -> it }) val x45 = select(A4(), { x: Number -> "" }) val x46 = select(A5(), { x: Number, y: Int -> "" }) - val x47 = select(A2(), id { a, b, c -> a; b; c }) - val x48 = select(id(A3()), { it }, { a -> a }) + val x47 = select(A2(), id { a, b, c -> a; b; c }) + val x48 = select(id(A3()), { it }, { a -> a }) val x49 = select(A3(), id(")!>A3::foo1)) - val x50 = select(A3(), ")!>A3::foo1, { a -> a }, { it -> it }) + val x50 = select(A3(), ")!>A3::foo1, { a -> a }, { it -> it }) val x51 = select(A4(), id { x: Number -> x }) val x52 = select(id(A5()), id { x: Number, y: Int -> x;y }) - val x53 = select(id(A5()), id { x, y -> x;y }) + val x53 = select(id(A5()), id { x, y -> x;y }) val x54 = select(id(")!>A5()), id { x: Number, y: Int -> x;y }) - val x55: Function2 = select(id(A5()), id { x, y -> x;y; 1f }) + val x55: Function2 = select(id(A5()), id { x, y -> x;y; 1f }) } fun Unit> selectNumber(arg1: T, arg2: T, arg3: T) = arg1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.fail b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.fail deleted file mode 100644 index 1f87de94e93..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.fail +++ /dev/null @@ -1,8 +0,0 @@ -Failures detected in FirBodyResolveTransformerAdapter, file: /callableReferences.fir.kt -Cause: java.lang.RuntimeException: While resolving call R?C|/selectNumber|(R?C|/id|(::R?C|/foo6|), R?C|/id|( = id@fun .(x: ): { - x# -} -), R?C|/id|( = id@fun .(): { - it# -} -)) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt index 96b52e45bb3..32829ab8ea4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/callableReferences.fir.kt @@ -31,27 +31,27 @@ fun foo6(x: Float) {} fun foo6(x: Number) {} fun main() { - select(::foo, { it }) + select(::foo, { it }) select(id(::foo), { x: Number -> }, { it }) - val x1 = select(")!>id(::foo), kotlin.Number")!>id { x: Number -> x }) - kotlin.Any")!>x1 + val x1 = select(")!>id(::foo), ")!>id { x: Number -> x }) + ")!>x1 - val x11 = select(id(::foo), id { x: Number -> }, id { it }) - kotlin.Any")!>x11 + val x11 = select(id(::foo), id { x: Number -> }, id { it }) + ")!>x11 - select(id(::foo2), id { x: Int -> }, id { it }) + select(id(::foo2), id { x: Int -> }, id { it }) - select(id(")!>::foo3), id { x: Int -> }, id { it }) - select(id(")!>::foo3), id { x: Number -> }, id { it }) - select(id(")!>::foo3), id { x: Number -> }, id { x: Int -> }, id { it }) + select(id(")!>::foo3), id { x: Int -> }, id { it }) + select(id(")!>::foo3), id { x: Number -> }, id { it }) + select(id(")!>::foo3), id { x: Number -> }, id { x: Int -> }, id { it }) - select(id(")!>::foo4), id { x: A -> }, id { it }) - select(id(")!>::foo4), id { x: B -> }, id { it }) + select(id(::foo4), id { x: A -> }, id { it }) + select(id(::foo4), id { x: B -> }, id { it }) // Expected ambiguity - select(id(::foo4), id { x: A -> }, id { x: B -> }, id { it }) + select(id(::foo4), id { x: A -> }, id { x: B -> }, id { it }) - select(id(::foo5), id { x: A -> }, id { x: B -> }, id { it }) + select(id(::foo5), id { x: A -> }, id { x: B -> }, id { it }) - val x2: (Int) -> Unit = selectNumber(id(")!>::foo6), id { x -> & Number}")!>x }, id { & Number}")!>it }) + val x2: (Int) -> Unit = selectNumber(id(")!>::foo6), id { x -> x }, id { it }) } diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.fail b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.fail deleted file mode 100644 index 5ff560136a0..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.fail +++ /dev/null @@ -1,8 +0,0 @@ -Failures detected in FirBodyResolveTransformerAdapter, file: /suspendFunctions.fir.kt -Cause: java.lang.RuntimeException: While resolving call R?C|/takeSuspend|(R?C|/id|( = id@fun .(): { - it# -} -), takeSuspend@fun (x: R|kotlin/Int|): R|kotlin/Unit| { - ^ R|/x| -} -) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.kt index 770c150974a..fee33cb29c0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/suspendFunctions.fir.kt @@ -8,18 +8,18 @@ fun Unit, K: T> takeSuspend(x: T, y: K) = x fun Unit, K: T> takeSimpleFunction(x: T, y: K) = x fun main() { - select(suspend {}, kotlin.Unit")!>{}) - select( kotlin.Unit")!>{}, suspend {}) - select( kotlin.Unit")!>id {}, suspend {}) - select( kotlin.Unit")!>id {}, id(suspend {})) - select( kotlin.Unit")!>id {}, id Unit> {}) + select(suspend {}, ")!>{}) + select(")!>{}, suspend {}) + select(")!>id {}, suspend {}) + select(")!>id {}, id(suspend {})) + select(")!>id {}, id Unit> {}) - takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit")!>{ x -> x }) + takeSuspend( & kotlin.coroutines.SuspendFunction1")!>id { it }, ")!>{ x -> x }) - val x1: suspend (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit")!>{ x -> x }) + val x1: suspend (Int) -> Unit = takeSuspend(")!>id { it }, ")!>{ x -> x }) // Here, the error should be - val x2: (Int) -> Unit = takeSuspend( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) - val x3: suspend (Int) -> Unit = takeSimpleFunction( kotlin.Unit")!>id { it }, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{ x -> x }) - val x4: (Int) -> Unit = takeSimpleFunction(id Unit> {}, kotlin.Unit"), TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>{}) + val x2: (Int) -> Unit = takeSuspend( & kotlin.Function1")!>id { it }, ")!>{ x -> x }) + val x3: suspend (Int) -> Unit = takeSimpleFunction( & kotlin.coroutines.SuspendFunction1")!>id { it }, ")!>{ x -> x }) + val x4: (Int) -> Unit = takeSimpleFunction(id Unit> {}, ")!>{}) }