From 7df6575a183a78a8211071212bcec87fdf5c8a58 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 23 Nov 2020 20:45:10 +0300 Subject: [PATCH] [IR] update testdata: unify representation for error nodes --- .../useNextParamInLambda.fir.kt.txt | 5 +++-- .../errors/unresolvedReference.fir.kt.txt | 17 +++++++++-------- .../irText/errors/unresolvedReference.kt.txt | 16 ++++++++-------- .../expressions/badBreakContinue.fir.kt.txt | 13 +++++++------ .../expressions/badBreakContinue.kt.txt | 16 ++++++++-------- .../caoWithAdaptationForSam.fir.kt.txt | 5 +++-- .../ir/irText/expressions/kt24804.fir.kt.txt | 3 ++- .../ir/irText/expressions/kt36963.kt.txt | 2 +- .../irText/expressions/lambdaInCAO.fir.kt.txt | 3 ++- .../arrayAsVarargAfterSamArgument.fir.kt.txt | 19 ++++++++++--------- .../samConversionsWithSmartCasts.fir.kt.txt | 5 +++-- ...ignedToUnsignedConversions_test.fir.kt.txt | 15 ++++++++------- .../whenWithSubjectVariable.fir.kt.txt | 5 +++-- .../castsInsideCoroutineInference.fir.kt.txt | 11 ++++++----- 14 files changed, 73 insertions(+), 62 deletions(-) diff --git a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt index ff26f4f0234..08edbffa382 100644 --- a/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.fir.kt.txt @@ -1,5 +1,5 @@ -fun f(f1: Function0 = local fun (): ErrorType /* ERROR */ { - return error("") /* ERROR CALL */ +fun f(f1: Function0 = local fun (): ErrorType { + return error("") /* ErrorCallExpression */ } , f2: Function0 = local fun (): String { return "FAIL" @@ -23,3 +23,4 @@ fun box(): String { } )) } + diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt index 6194e780b11..9f1140cad40 100644 --- a/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt +++ b/compiler/testData/ir/irText/errors/unresolvedReference.fir.kt.txt @@ -1,15 +1,16 @@ -val test1: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test1: ErrorType + field = error("") /* ErrorCallExpression */ get -val test2: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test2: ErrorType + field = error("") /* ErrorCallExpression */ get -val test3: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */56; +val test3: ErrorType + field = error("") /* ErrorCallExpression */56; get -val test4: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */error("") /* ERROR EXPRESSION */; +val test4: ErrorType + field = error("") /* ErrorCallExpression */error("") /* ErrorExpression */; get + diff --git a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt index f618965774b..08b6fef48b5 100644 --- a/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt +++ b/compiler/testData/ir/irText/errors/unresolvedReference.kt.txt @@ -1,16 +1,16 @@ -val test1: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test1: ErrorType + field = error("") /* ErrorCallExpression */ get -val test2: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */ +val test2: ErrorType + field = error("") /* ErrorCallExpression */ get -val test3: ErrorType /* ERROR */ - field = error("") /* ERROR CALL */42; 56; +val test3: ErrorType + field = error("") /* ErrorCallExpression */42; 56; get -val test4: ErrorType /* ERROR */ - field = error("") /* ERROR EXPRESSION */ +val test4: ErrorType + field = error("") /* ErrorExpression */ get diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt index 64d184dc86f..68b59c5774b 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.fir.kt.txt @@ -1,12 +1,12 @@ fun test1() { - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } fun test2() { L1@ while (true) { // BLOCK - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } } @@ -21,8 +21,9 @@ fun test3() { } fun test4() { - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } } + diff --git a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt index 4171a8d0714..61259595601 100644 --- a/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt +++ b/compiler/testData/ir/irText/expressions/badBreakContinue.kt.txt @@ -1,29 +1,29 @@ fun test1() { - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } fun test2() { L1@ while (true) { // BLOCK - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } } fun test3() { L1@ while (true) { // BLOCK val lambda: Function0 = local fun (): Nothing { - error("") /* ERROR EXPRESSION */ - error("") /* ERROR EXPRESSION */ + error("") /* ErrorExpression */ + error("") /* ErrorExpression */ } } } fun test4() { - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } - while (error("") /* ERROR EXPRESSION */) { // BLOCK + while (error("") /* ErrorExpression */) { // BLOCK } } diff --git a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt index 21a1418b094..e5e4428a590 100644 --- a/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/callableReferences/caoWithAdaptationForSam.fir.kt.txt @@ -47,7 +47,7 @@ fun test1() { { // BLOCK val <>: A = A val <>: KFunction1 = ::withVararg - error("") /* ERROR CALL */<>; error("") /* ERROR CALL */<>; .plus(other = 1); + error("") /* ErrorCallExpression */<>; error("") /* ErrorCallExpression */<>; .plus(other = 1); } } @@ -55,7 +55,7 @@ fun test2() { { // BLOCK val <>: B = B val <>: KFunction1 = ::withVararg - error("") /* ERROR CALL */<>; error("") /* ERROR CALL */<>; .plus(other = 1); + error("") /* ErrorCallExpression */<>; error("") /* ErrorCallExpression */<>; .plus(other = 1); } } @@ -95,3 +95,4 @@ fun test6(a: Any) { <>.set(i = <>, newValue = <>.get(i = <>).plus(other = 1)) } } + diff --git a/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt b/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt index 509317c8937..c2d80af741b 100644 --- a/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt24804.fir.kt.txt @@ -10,7 +10,7 @@ fun run(x: Boolean, y: Boolean): String { greater(arg0 = z, arg1 = 100) -> return "NOT_OK" } when { - x -> error("") /* ERROR EXPRESSION */ + x -> error("") /* ErrorExpression */ } when { y -> continue@l2 @@ -22,3 +22,4 @@ fun run(x: Boolean, y: Boolean): String { fun box(): String { return run(x = true, y = true) } + diff --git a/compiler/testData/ir/irText/expressions/kt36963.kt.txt b/compiler/testData/ir/irText/expressions/kt36963.kt.txt index 3e01d5be37d..ffb3b8a04d3 100644 --- a/compiler/testData/ir/irText/expressions/kt36963.kt.txt +++ b/compiler/testData/ir/irText/expressions/kt36963.kt.txt @@ -1,7 +1,7 @@ fun foo() { } -fun test(): ErrorType /* ERROR */ { +fun test(): ErrorType { return CHECK_NOT_NULL>(arg0 = ::foo) } diff --git a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt index f6c877506fb..d1f0b5ede72 100644 --- a/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/lambdaInCAO.fir.kt.txt @@ -16,7 +16,7 @@ fun test1(a: Any) { } fun test2(a: Any) { - error("") /* ERROR CALL */ + error("") /* ErrorCallExpression */ } fun test3(a: Any) { @@ -29,3 +29,4 @@ fun test3(a: Any) { .set(index = , value = .inc()) /*~> Unit */ } + diff --git a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt index 77f1971f85c..a5a20b12083 100644 --- a/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/arrayAsVarargAfterSamArgument.fir.kt.txt @@ -1,5 +1,5 @@ fun test(fn: Function0, r: Runnable, arr: Array) { - error("") /* ERROR CALL */local fun () { + error("") /* ErrorCallExpression */local fun () { return Unit } ; arr; @@ -7,13 +7,13 @@ fun test(fn: Function0, r: Runnable, arr: Array) { return Unit } /*-> Runnable? */, strs = [*arr]) /*~> Unit */ - error("") /* ERROR CALL */fn; arr; + error("") /* ErrorCallExpression */fn; arr; foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */ foo1(r = r, strs = [""]) /*~> Unit */ - error("") /* ERROR CALL */fn; arr; + error("") /* ErrorCallExpression */fn; arr; foo1(r = fn /*-> Runnable? */, strs = [*arr]) /*~> Unit */ foo1(r = r, strs = [*arr]) /*~> Unit */ - val i1: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun () { + val i1: ErrorType = error("") /* ErrorCallExpression */local fun () { return Unit } ; arr; @@ -21,7 +21,7 @@ fun test(fn: Function0, r: Runnable, arr: Array) { return Unit } /*-> Runnable? */, strs = [*arr]) - val i3: ErrorType /* ERROR */ = error("") /* ERROR CALL */local fun () { + val i3: ErrorType = error("") /* ErrorCallExpression */local fun () { return Unit } ; local fun () { @@ -43,26 +43,27 @@ fun test(fn: Function0, r: Runnable, arr: Array) { return Unit } /*-> Runnable? */, strs = [*arr]) - error("") /* ERROR CALL */local fun () { + error("") /* ErrorCallExpression */local fun () { return Unit } ; local fun () { return Unit } ; arr; - error("") /* ERROR CALL */r; local fun () { + error("") /* ErrorCallExpression */r; local fun () { return Unit } ; ""; - error("") /* ERROR CALL */local fun () { + error("") /* ErrorCallExpression */local fun () { return Unit } ; local fun () { return Unit } ; arr; - error("") /* ERROR CALL */r; local fun () { + error("") /* ErrorCallExpression */r; local fun () { return Unit } ; arr; } + diff --git a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt index cf210020075..ee1b3d61c77 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConversionsWithSmartCasts.fir.kt.txt @@ -44,13 +44,14 @@ fun test6(a: Any) { fun test7(a: Function1) { a as Function0 /*~> Unit */ - error("") /* ERROR CALL */a /*as Function0 */; + error("") /* ErrorCallExpression */a /*as Function0 */; } fun test8(a: Function0) { - error("") /* ERROR CALL */id?>(x = a); + error("") /* ErrorCallExpression */id?>(x = a); } fun test9() { J().run1(r = ::test9 /*-> Runnable? */) } + diff --git a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt index 04c0939354d..49dbb8c9740 100644 --- a/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/signedToUnsignedConversions_test.fir.kt.txt @@ -47,11 +47,12 @@ fun takeLong(@ImplicitIntegerCoercion l: Long) { } fun test() { - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */256; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; - error("") /* ERROR CALL */255; 255; 42; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */256; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; + error("") /* ErrorCallExpression */255; 255; 42; } + diff --git a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt index 8a108d7366d..039a6f4f044 100644 --- a/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt +++ b/compiler/testData/ir/irText/expressions/whenWithSubjectVariable.fir.kt.txt @@ -9,9 +9,10 @@ fun test(): Int { EQEQ(arg0 = y, arg1 = 42) -> 1 y is String -> y /*as String */.() y !is Int -> 2 - error("") /* ERROR CALL */y; -> 3 - error("") /* ERROR CALL */y; .not() -> 4 + error("") /* ErrorCallExpression */y; -> 3 + error("") /* ErrorCallExpression */y; .not() -> 4 else -> -1 } } } + diff --git a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt index 7613c9da99e..5d56f89742b 100644 --- a/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt +++ b/compiler/testData/ir/irText/types/castsInsideCoroutineInference.fir.kt.txt @@ -1,7 +1,7 @@ @OptIn(markerClass = [ExperimentalTypeInference::class]) fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Unit>): Flow { return flow(block = local suspend fun FlowCollector.() { - val collector: FlowCollector = + val collector: FlowCollector = flowScope(block = local suspend fun CoroutineScope.() { block.invoke(p1 = , p2 = collector) } @@ -12,7 +12,7 @@ fun scopedFlow(@BuilderInference block: @ExtensionFunctionType @Exten fun Flow.onCompletion(action: @ExtensionFunctionType @ExtensionFunctionType SuspendFunction2, Throwable?, Unit>): Flow { return unsafeFlow(block = local suspend fun FlowCollector.() { - val safeCollector: SafeCollector = SafeCollector(collector = ) + val safeCollector: SafeCollector = SafeCollector(collector = ) safeCollector.invokeSafely(action = action) } ) @@ -27,9 +27,9 @@ inline fun unsafeFlow(@BuilderInference crossinline block: @Extension } @Deprecated(message = "binary compatibility with a version w/o FlowCollector receiver", level = DeprecationLevel.HIDDEN) -fun Flow.onCompletion(action: SuspendFunction1): ErrorType /* ERROR */ { - return error("") /* ERROR CALL */local fun () { - action.invoke(p1 = error("") /* ERROR CALL */) +fun Flow.onCompletion(action: SuspendFunction1): ErrorType { + return error("") /* ErrorCallExpression */local fun () { + action.invoke(p1 = error("") /* ErrorCallExpression */) } ; } @@ -141,3 +141,4 @@ interface SendChannel { abstract suspend fun send(e: E) } +