From 5abab2197bc45f5fe489aef4494c7dee74bd049a Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Fri, 23 Jun 2023 13:05:49 +0200 Subject: [PATCH] [FIR] Adapt positioning of NO_VALUE_FOR_PARAMETER to match K1 --- .../testData/resolve/arguments/default.kt | 2 +- .../resolve/arguments/defaultFromOverrides.kt | 2 +- .../testData/resolve/arguments/lambda.kt | 2 +- .../testData/resolve/arguments/simple.kt | 2 +- .../LightTreePositioningStrategies.kt | 3 +- .../diagnostics/PositioningStrategies.kt | 3 +- .../tests/FunctionCalleeExpressions.fir.kt | 9 ++--- .../tests/FunctionCalleeExpressions.kt | 1 - .../tests/annotations/ConstructorCall.fir.kt | 36 ------------------ .../tests/annotations/ConstructorCall.kt | 1 + .../property/memberFromTopLevel.fir.kt | 2 +- .../tests/delegation/kt44843.fir.kt | 4 +- .../extensions/ExtensionFunctions.fir.kt | 2 +- .../extensions/ExtensionsCalledOnSuper.fir.kt | 2 +- .../fromKEEP/autoCloseScope.fir.kt | 34 ----------------- .../fromKEEP/autoCloseScope.kt | 1 + .../higherOrderCallMissingParameters.fir.kt | 16 -------- .../higherOrderCallMissingParameters.kt | 1 + .../inference/invokeLambdaAsFunction.fir.kt | 2 +- .../specialCallsWithCallableReferences.fir.kt | 38 +++++++++---------- ...omQualifiersWithIrrelevantCandidate.fir.kt | 6 +-- .../j+k/genericConstructor/recursive.fir.kt | 11 ------ .../tests/j+k/genericConstructor/recursive.kt | 1 + .../testData/diagnostics/tests/kt435.fir.kt | 8 ---- compiler/testData/diagnostics/tests/kt435.kt | 2 +- .../namedArgumentsAndDefaultValues.fir.kt | 2 +- .../receiverPresenceErrorForInvoke.fir.kt | 4 +- .../wrongReceiverForInvokeOnExpression.fir.kt | 2 +- .../resolve/invoke/invokeAndSmartCast.fir.kt | 4 +- ...OnVariableWithExtensionFunctionType.fir.kt | 8 ++-- .../tests/resolve/invoke/kt9805.fir.kt | 17 --------- .../tests/resolve/invoke/kt9805.kt | 1 + .../tests/resolve/newLineLambda.fir.kt | 6 +-- ...izerOfDestructuringDeclarationOnce.fir.kts | 2 +- .../errorsOnEmptyDelegationCall.fir.kt | 2 +- .../noPrimaryConstructor.fir.kt | 6 --- .../noPrimaryConstructor.kt | 1 + .../typealiasesAsConstructors.fir.kt | 4 +- .../testsWithStdLib/inference/kt11266.fir.kt | 3 -- .../testsWithStdLib/inference/kt11266.kt | 1 + .../testsWithStdLib/inference/kt1558.fir.kt | 8 ++-- .../regression/ea70880_illegalJvmName.fir.kt | 2 +- 42 files changed, 70 insertions(+), 194 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/kt435.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt delete mode 100644 compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt index 8c66abec707..ac097bd9833 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/default.kt @@ -8,7 +8,7 @@ fun test() { foo(1, 2.0, true) foo(1, third = true) - foo() + foo() foo(0, 0.0, false, "") bar(1, third = true) diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt index f8766fe9b1f..62317659dc7 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/defaultFromOverrides.kt @@ -15,7 +15,7 @@ fun foo(a: A) { a.foo() a.foo(1) - a.bar() + a.bar() a.bar("") a.bar(y = 1) a.bar("", 2) diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt index 1079808b0de..a6e28c278e9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/lambda.kt @@ -29,6 +29,6 @@ fun test() { // Bad baz {} - baz() {} + baz() {} baz(other = false) {} } diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt index c425dce5d72..0415cdb74be 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/simple.kt @@ -7,7 +7,7 @@ fun test() { foo(1, second = 3.14, third = false, fourth = "!?") foo(third = false, second = 2.71, fourth = "?!", first = 0) - foo() + foo() foo(0.0, false, 0, "") foo(1, 2.0, third = true, "") foo(second = 0.0, first = 0, fourth = "") diff --git a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt index e61842b03dc..3e1361e5d2b 100644 --- a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt +++ b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/LightTreePositioningStrategies.kt @@ -590,7 +590,8 @@ object LightTreePositioningStrategies { if (lastArgument != null) { markRange(lastArgument, rightParenthesis, startOffset, endOffset, tree, node) } else { - markRange(nodeToStart, rightParenthesis, startOffset, endOffset, tree, node) + val leftParenthesis = tree.findLastChildByType(argumentList, LPAR) + markRange(leftParenthesis?: nodeToStart, rightParenthesis, startOffset, endOffset, tree, node) } } diff --git a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 2ab47fbcb2a..60b5b80144d 100644 --- a/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend.common-psi/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -693,7 +693,8 @@ object PositioningStrategies { if (lastArgument != null) { markRange(lastArgument, rightParenthesis) } else { - markRange(qualifiedAccess, rightParenthesis) + val leftParenthesis = argumentList.leftParenthesis + markRange(leftParenthesis ?: qualifiedAccess, rightParenthesis) } } diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt index aefedb622d4..2f9e8397e46 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.fir.kt @@ -1,4 +1,3 @@ -// COMPARE_WITH_LIGHT_TREE // !CHECK_TYPE package foo @@ -28,8 +27,8 @@ fun fooT2() : (t : T) -> T { fun main(args : Array) { args.foo()() - args.foo1()() - a.foo1()() + args.foo1()() + a.foo1()() a.foo1()(a) args.foo1()(1) @@ -76,8 +75,8 @@ fun main1() { } fun test() { - {x : Int -> 1}(); - (fun Int.() = 1)() + {x : Int -> 1}(); + (fun Int.() = 1)() "sd".(fun Int.() = 1)() val i : Int? = null i.(fun Int.() = 1)(); diff --git a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt index 85869a9e79e..1e3d1ca92f1 100644 --- a/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt +++ b/compiler/testData/diagnostics/tests/FunctionCalleeExpressions.kt @@ -1,4 +1,3 @@ -// COMPARE_WITH_LIGHT_TREE // !CHECK_TYPE package foo diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt deleted file mode 100644 index 9f87b899c84..00000000000 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.fir.kt +++ /dev/null @@ -1,36 +0,0 @@ -// !LANGUAGE: -InstantiationOfAnnotationClasses -annotation class Ann -annotation class Ann1(val a: Int) -annotation class Ann2(val a: Ann1) - -annotation class Ann3(val a: Ann1 = Ann1(1)) - -annotation class Ann4(val value: String) - -@Ann2(Ann1(1)) val a = 1 - -@Ann2(a = Ann1(1)) val c = 2 - -@Ann4("a") class MyClass - -fun foo() { - Ann() - val a = Ann() - - Ann1() - Ann1(1) - bar(Ann()) - bar(a = Ann()) - - val ann = javaClass().getAnnotation(javaClass()) - ann!!.value() -} - -fun bar(a: Ann = Ann()) { - if (a is Ann) {} -} - -operator fun String.invoke() {} - -// from stdlib -fun javaClass() : Class = null as Class diff --git a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt index f1585e0c5cc..9c14a65b739 100644 --- a/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt +++ b/compiler/testData/diagnostics/tests/annotations/ConstructorCall.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: -InstantiationOfAnnotationClasses annotation class Ann annotation class Ann1(val a: Int) diff --git a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt index 13c4963dc2d..f27ef0b964f 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/memberFromTopLevel.fir.kt @@ -13,7 +13,7 @@ fun test() { checkSubtype>(p) checkSubtype>(p) checkSubtype(p.get(A())) - p.get() + p.get() p.set(A(), 239) val q = A::bar diff --git a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt index 153b3c1f2df..b0aaa61274f 100644 --- a/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt +++ b/compiler/testData/diagnostics/tests/delegation/kt44843.fir.kt @@ -1,13 +1,13 @@ // WITH_STDLIB // FILE: test.kt -val bar2 by bar2() +val bar2 by bar2() // FILE: lt/neworld/compiler/Foo.kt package lt.neworld.compiler class Foo { - val bar by bar() + val bar by bar() } // FILE: lt/neworld/compiler/bar/Bar.kt diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt index 8db9d5de988..6ad3f2a1280 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionFunctions.fir.kt @@ -19,7 +19,7 @@ class A infix operator fun A.plus(a : Any) { 1.foo() - true.foo() + true.foo() 1 } diff --git a/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt b/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt index 65048ca9df0..fafd0e63b37 100644 --- a/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/ExtensionsCalledOnSuper.fir.kt @@ -16,7 +16,7 @@ class C : T { super.foo() // OK super.bar() // Error super.buzz() // OK, resolved to a member - super.buzz1() // Resolved to an extension + super.buzz1() // Resolved to an extension super.buzz1("") // Resolved to a member } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt deleted file mode 100644 index e22fd6dfc14..00000000000 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.fir.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !LANGUAGE: +ContextReceivers - -class File(name: String) -interface InputStream - -interface AutoCloseScope { - fun defer(closeBlock: () -> Unit) - fun close() -} -class AutoCloseScopeImpl : AutoCloseScope { - override fun defer(closeBlock: () -> Unit) = TODO() - override fun close() = TODO() -} - -context(AutoCloseScope) -fun File.open(): InputStream = TODO() - -fun withAutoClose(block: context(AutoCloseScope) () -> Unit) { - val scope = AutoCloseScopeImpl() // Not shown here - try { - with(scope) { block() } - } finally { - scope.close() - } -} - -fun test() { - withAutoClose { - val input = File("input.txt").open() - val config = File("config.txt").open() - // Work - // All files are closed at the end - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt index 45b6e5e7243..aae97cbba02 100644 --- a/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt +++ b/compiler/testData/diagnostics/tests/extensions/contextReceivers/fromKEEP/autoCloseScope.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !LANGUAGE: +ContextReceivers class File(name: String) diff --git a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt deleted file mode 100644 index cac4dd0e83b..00000000000 --- a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.fir.kt +++ /dev/null @@ -1,16 +0,0 @@ -// See KT-7813: Call to functional parameter with missing argument: no error detected but compiler crashes - -fun foo(p: (Int, () -> Int) -> Unit) { - // Errors except last call - p { 1 } - p() { 2 } - p(3) { 4 } -} - -fun bar(p: (String, Any, () -> String) -> Unit) { - // Errors except last call - p { "" } - p() { "x" } - p("y") { "z" } - p("v", Any()) { "w" } -} diff --git a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt index 319480596d2..126bcadda2f 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt +++ b/compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // See KT-7813: Call to functional parameter with missing argument: no error detected but compiler crashes fun foo(p: (Int, () -> Int) -> Unit) { diff --git a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt index 7a426fba8fc..07047a5c1eb 100644 --- a/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/invokeLambdaAsFunction.fir.kt @@ -2,6 +2,6 @@ fun test1(i: Int) = { i -> i }(i) -fun test2() = { i -> i }() +fun test2() = { i -> i }() fun test3() = { i -> i }(1) diff --git a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt index 44263d33920..26e6c6552ad 100644 --- a/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/specialCallsWithCallableReferences.fir.kt @@ -35,7 +35,7 @@ fun poll11(flag: Boolean) { fun poll12(flag: Boolean) { val inv = if (flag) { ::bar3 } else { ::foo3 } - inv() + inv() } fun poll13(flag: Boolean) { @@ -45,12 +45,12 @@ fun poll13(flag: Boolean) { fun poll14(flag: Boolean) { val inv = if (flag) { ::bar4 } else { ::foo4 } - inv() + inv() } fun poll15(flag: Boolean) { val inv = if (flag) { ::bar5 } else { ::foo5 } - inv() + inv() } fun poll16(flag: Boolean) { @@ -65,7 +65,7 @@ fun poll17(flag: Boolean) { fun poll2(flag: Boolean) { val inv = when (flag) { true -> ::bar else -> ::foo } - inv() + inv() } fun poll21(flag: Boolean) { @@ -75,12 +75,12 @@ fun poll21(flag: Boolean) { fun poll22(flag: Boolean) { val inv = when (flag) { true -> ::bar3 else -> ::foo3 } - inv() + inv() } fun poll23(flag: Boolean) { val inv = when (flag) { true -> ::bar4 else -> ::foo4 } - inv() + inv() } fun poll24(flag: Boolean) { @@ -100,7 +100,7 @@ fun poll26(flag: Boolean) { fun poll3(flag: Boolean) { val inv = when (flag) { true -> ::bar false -> ::foo } - inv() + inv() } fun poll31(flag: Boolean) { @@ -110,12 +110,12 @@ fun poll31(flag: Boolean) { fun poll32(flag: Boolean) { val inv = when (flag) { true -> ::bar3 false -> ::foo3 } - inv() + inv() } fun poll33(flag: Boolean) { val inv = when (flag) { true -> ::bar4 false -> ::foo4 } - inv() + inv() } fun poll34(flag: Boolean) { @@ -135,7 +135,7 @@ fun poll36(flag: Boolean) { fun poll4() { val inv = try { ::bar } finally { ::foo } - inv() + inv() } fun poll41() { @@ -145,17 +145,17 @@ fun poll41() { fun poll42() { val inv = try { ::bar3 } finally { ::foo3 } - inv() + inv() } fun poll43() { val inv = try { ::bar4 } finally { ::foo4 } - inv() + inv() } fun poll44() { val inv = try { ::bar5 } finally { ::foo5 } - inv() + inv() } fun poll45() { @@ -170,7 +170,7 @@ fun poll46() { fun poll5() { val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo } - inv() + inv() } fun poll51() { @@ -180,17 +180,17 @@ fun poll51() { fun poll52() { val inv = try { ::bar3 } catch (e: Exception) { ::foo3 } finally { ::foo3 } - inv() + inv() } fun poll53() { val inv = try { ::bar4 } catch (e: Exception) { ::foo4 } finally { ::foo4 } - inv() + inv() } fun poll54() { val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 } - inv() + inv() } fun poll55() { @@ -240,7 +240,7 @@ fun poll66() { fun poll7() { val inv = ::bar!! - inv() + inv() } fun poll71() { @@ -250,7 +250,7 @@ fun poll71() { fun poll72() { val inv = ::bar3!! - inv() + inv() } fun poll73() { diff --git a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt index 2adf29dd94d..e187e9e7b76 100644 --- a/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt +++ b/compiler/testData/diagnostics/tests/inner/innerConstructorsFromQualifiersWithIrrelevantCandidate.fir.kt @@ -12,7 +12,7 @@ class Outer { fun baz() { // Diagnostic here could be better (why can't I call the constructor above?) - Inner() + Inner() Inner(1) Inner("") } @@ -20,7 +20,7 @@ class Outer { } fun foo() { - Outer.Inner() + Outer.Inner() Outer.Inner(1) Outer.Inner("") } @@ -31,7 +31,7 @@ import abc.Outer.Inner import abc.Outer.Companion.Inner fun bar() { - Inner() + Inner() Inner(1) Inner("") diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt deleted file mode 100644 index ca052faecd4..00000000000 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// FILE: C.java - -// See KT-10410 -public class C { - public C(T t) { - } -} - -// FILE: main.kt - -fun foo() = C() diff --git a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt index 65a22ee4dfd..2cc639a16bb 100644 --- a/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt +++ b/compiler/testData/diagnostics/tests/j+k/genericConstructor/recursive.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // FILE: C.java // See KT-10410 diff --git a/compiler/testData/diagnostics/tests/kt435.fir.kt b/compiler/testData/diagnostics/tests/kt435.fir.kt deleted file mode 100644 index e61c2300bd7..00000000000 --- a/compiler/testData/diagnostics/tests/kt435.fir.kt +++ /dev/null @@ -1,8 +0,0 @@ -// COMPARE_WITH_LIGHT_TREE -fun Any.foo1() : (i : Int) -> Unit { - return {} -} - -fun test(a : Any) { - a.foo1()() -} diff --git a/compiler/testData/diagnostics/tests/kt435.kt b/compiler/testData/diagnostics/tests/kt435.kt index be3b10e2332..e90ab963d71 100644 --- a/compiler/testData/diagnostics/tests/kt435.kt +++ b/compiler/testData/diagnostics/tests/kt435.kt @@ -1,4 +1,4 @@ -// COMPARE_WITH_LIGHT_TREE +// FIR_IDENTICAL fun Any.foo1() : (i : Int) -> Unit { return {} } diff --git a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt index 4dca2c8100e..762d18f3200 100644 --- a/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt +++ b/compiler/testData/diagnostics/tests/namedArguments/namedArgumentsAndDefaultValues.fir.kt @@ -14,7 +14,7 @@ fun test() { foo(1, "", "") bar(z = "") - bar() + bar() bar("") bar(1, 1, "") bar(1, 1, "") diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt index 7f7f7dc821b..df552565076 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/receiverPresenceErrorForInvoke.fir.kt @@ -1,7 +1,7 @@ fun test1(f: String.() -> Unit) { - (f)() + (f)() - f() + f() } fun test2(f: (Int) -> Int) { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt index 9b3fb216876..d944dd6727f 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/errors/wrongReceiverForInvokeOnExpression.fir.kt @@ -6,7 +6,7 @@ fun test1() { fun test2(f: String.(Int) -> Unit) { 11.(f)(1) - 11.(f)() + 11.(f)() } fun test3() { diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt index 2517643820b..75f6a803bde 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeAndSmartCast.fir.kt @@ -11,10 +11,10 @@ fun test(a: A) { (a.x)("") with("") { - a.x() + a.x() (a.x)() if (a.x != null) { - a.x() // todo + a.x() // todo (a.x)() } } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt index 1be2418d663..87a1cfc5754 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/invokeOnVariableWithExtensionFunctionType.fir.kt @@ -23,8 +23,8 @@ fun test(a: A, b: B) { } with(b) { - a.foo() - a.(foo)() + a.foo() + a.(foo)() (a.foo)() @@ -65,8 +65,8 @@ fun test(a: A, b: B) { } with(b) { - a.foo() - a.(foo)() + a.foo() + a.(foo)() (a.foo)() diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt deleted file mode 100644 index 26d45e3534e..00000000000 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.fir.kt +++ /dev/null @@ -1,17 +0,0 @@ -class A { - val foo: B.() -> Unit get() = null!! -} - -class B - -fun test(a: A, b: B) { - with(b) { - a.foo() // here must be error, because a is not extension receiver - - a.foo(this) - - (a.foo)() - - (a.foo)(this) - } -} diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt index dc797a1979d..fb308602a77 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt9805.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL class A { val foo: B.() -> Unit get() = null!! } diff --git a/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt b/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt index 3bf1d920507..aa778e14fa5 100644 --- a/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/newLineLambda.fir.kt @@ -28,7 +28,7 @@ fun testNoArgs() { } fun testLambdaArg() { - oneLambdaArg() + oneLambdaArg() oneLambdaArg {} oneLambdaArg() {} @@ -40,7 +40,7 @@ fun testLambdaArg() { {} ) oneLambdaArg() {} - oneLambdaArg() // {} + oneLambdaArg() // {} oneLambdaArg() /* */ {} oneLambdaArg() /* block @@ -95,7 +95,7 @@ fun testTwoLambdas() { ) fun bar(): () -> Unit { - twoLambdaArgs() + twoLambdaArgs() {} {} diff --git a/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.fir.kts b/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.fir.kts index e06ef9ad611..2cfe812862a 100644 --- a/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.fir.kts +++ b/compiler/testData/diagnostics/tests/script/resolveInitializerOfDestructuringDeclarationOnce.fir.kts @@ -1,4 +1,4 @@ -val (a, b, c) = A() +val (a, b, c) = A() class A(val a: Int) { operator fun component1() {} diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt index 4dd23ce1c53..1d56331f954 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/errorsOnEmptyDelegationCall.fir.kt @@ -3,7 +3,7 @@ open class B0(x: Int) class A0 : B0 { constructor() - constructor(x: Int) : super() + constructor(x: Int) : super() } // -------------------------- diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt deleted file mode 100644 index 9f373b0777b..00000000000 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.fir.kt +++ /dev/null @@ -1,6 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -class A { - constructor(x: Int) -} - -val x = A() diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt index 4c2fc25be5d..abbec8adefa 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/noPrimaryConstructor.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER class A { constructor(x: Int) diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt index 33ffd91af68..648832fdbb6 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/apiVersion/typealiasesAsConstructors.fir.kt @@ -13,8 +13,8 @@ open class C2(val x: Int) { typealias C2_Alias = C2 val test1 = C1_Alias() -val test2 = C2_Alias() +val test2 = C2_Alias() class Test3 : C1_Alias() -class Test4 : C2_Alias() +class Test4 : C2_Alias() diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt deleted file mode 100644 index 2d5a4b2302c..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.fir.kt +++ /dev/null @@ -1,3 +0,0 @@ -// NI_EXPECTED_FILE - -fun foo(first: Array, second: Array) = Pair(first.toCollection(), second.toCollection()) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt index a2baf8bed8f..bb047305099 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt11266.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // NI_EXPECTED_FILE fun foo(first: Array, second: Array) = Pair(first.toCollection(), second.toCollection()) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt index 2f97dc0bc23..f3d6aecd3a1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt1558.fir.kt @@ -12,13 +12,13 @@ fun List<*>.toArray(ar: Array): Array = ar fun testArrays(ci: List, cii: List?) { val c1: Array = cii.sure().toArray(Array) - val c2: Array = ci.toArray(Array()) + val c2: Array = ci.toArray(Array()) - val c3 = Array() + val c3 = Array() - val c4 = ci.toArray(Array()) + val c4 = ci.toArray(Array()) - val c5 = ci.toArray(Array()) + val c5 = ci.toArray(Array()) checkSubtype>(c1) checkSubtype>(c2) diff --git a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt index ad0fde54de0..020e8632f24 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/regression/ea70880_illegalJvmName.fir.kt @@ -1,4 +1,4 @@ -@JvmName() +@JvmName() fun foo() {} @JvmName(42)