diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/getterAssignment.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/getterAssignment.txt index 0f14bf4bb0e..db19cefc83e 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/getterAssignment.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/invalidCode/getterAssignment.txt @@ -1,3 +1,3 @@ KtErrorCallInfo: candidateCalls = [] - diagnostic = ERROR \ No newline at end of file + diagnostic = ERROR diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVar_lhs.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVar_lhs.txt index a2dae6d8062..4bef4dbb34a 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVar_lhs.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVar_lhs.txt @@ -1,6 +1,6 @@ KT element: KtNameReferenceExpression -FIR element: FirResolvedNamedReferenceImpl -FIR source kind: ReferenceInAtomicQualifiedAccess +FIR element: FirVariableAssignmentImpl +FIR source kind: KtRealSourceElementKind FIR element rendered: -R|/i| \ No newline at end of file +R|/i| = R|/i|.R|kotlin/Int.plus|(Int(1)) diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt b/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt index badccbe6c70..167822a7823 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt @@ -73,7 +73,7 @@ FILE: anonymousObjectInInvalidPosition.kt CONTRACTS: FILE: anonymousObjectInInvalidPosition.kt - private final [CONTRACTS] val resolveMe: = ERROR_EXPR(Should have initializer)# = object : A { + private final [CONTRACTS] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : A { private [RAW_FIR] [ContainingClassKey=] constructor(): R|| { super<>() } @@ -91,7 +91,7 @@ FILE: anonymousObjectInInvalidPosition.kt IMPLICIT_TYPES_BODY_RESOLVE: FILE: anonymousObjectInInvalidPosition.kt - private final [IMPLICIT_TYPES_BODY_RESOLVE] val resolveMe: = ERROR_EXPR(Should have initializer)# = object : A { + private final [IMPLICIT_TYPES_BODY_RESOLVE] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : A { private [RAW_FIR] [ContainingClassKey=] constructor(): R|| { super<>() } @@ -109,7 +109,7 @@ FILE: anonymousObjectInInvalidPosition.kt ANNOTATIONS_ARGUMENTS_MAPPING: FILE: anonymousObjectInInvalidPosition.kt - private final [ANNOTATIONS_ARGUMENTS_MAPPING] val resolveMe: = ERROR_EXPR(Should have initializer)# = object : A { + private final [ANNOTATIONS_ARGUMENTS_MAPPING] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : A { private [RAW_FIR] [ContainingClassKey=] constructor(): R|| { super<>() } @@ -127,7 +127,7 @@ FILE: anonymousObjectInInvalidPosition.kt EXPECT_ACTUAL_MATCHING: FILE: anonymousObjectInInvalidPosition.kt - private final [EXPECT_ACTUAL_MATCHING] val resolveMe: = ERROR_EXPR(Should have initializer)# = object : A { + private final [EXPECT_ACTUAL_MATCHING] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : A { private [RAW_FIR] [ContainingClassKey=] constructor(): R|| { super<>() } @@ -145,7 +145,7 @@ FILE: anonymousObjectInInvalidPosition.kt BODY_RESOLVE: FILE: anonymousObjectInInvalidPosition.kt - private final [BODY_RESOLVE] val resolveMe: = ERROR_EXPR(Should have initializer)# = object : R|A| { + private final [BODY_RESOLVE] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : R|A| { private [BODY_RESOLVE] [ContainingClassKey=] constructor(): R|| { super() } @@ -163,7 +163,7 @@ FILE: anonymousObjectInInvalidPosition.kt FILE RAW TO BODY: FILE: anonymousObjectInInvalidPosition.kt - private final [BODY_RESOLVE] val resolveMe: = ERROR_EXPR(Should have initializer)# = object : R|A| { + private final [BODY_RESOLVE] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : R|A| { private [BODY_RESOLVE] [ContainingClassKey=] constructor(): R|| { super() } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java index 58897f5d9c7..b83ae1be1f8 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java @@ -4630,6 +4630,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayInLocal.kt"); } + @Test + @TestMetadata("assignmentWithWrongLhs.kt") + public void testAssignmentWithWrongLhs() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.kt"); + } + @Test @TestMetadata("backingField.kt") public void testBackingField() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 4c5805cdbdc..9ecbf51c0c3 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -4168,6 +4168,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/cast/AsInBlockWithReturnType.kt"); } + @Test + @TestMetadata("AsInCompoundAssignment.kt") + public void testAsInCompoundAssignment() throws Exception { + runTest("compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt"); + } + @Test @TestMetadata("AsInExpressionBody.kt") public void testAsInExpressionBody() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolve/arguments/fieldPlusAssign.fir.txt b/compiler/fir/analysis-tests/testData/resolve/arguments/fieldPlusAssign.fir.txt index 211491ff902..9767e3e2429 100644 --- a/compiler/fir/analysis-tests/testData/resolve/arguments/fieldPlusAssign.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/arguments/fieldPlusAssign.fir.txt @@ -6,6 +6,6 @@ FILE: fieldPlusAssign.kt } public final val y: R|kotlin/Int| = Int(1) public get(): R|kotlin/Int| { - # = F|/y|.R|kotlin/Int.plus|(Int(1)) + F|/y| = F|/y|.R|kotlin/Int.plus|(Int(1)) ^ Int(1) } diff --git a/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt b/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt index f573b2bc7c3..d9dd5c0828d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt @@ -14,7 +14,7 @@ class Some { z = "error" fun foo() { - x = "error" // VAL_REASSIGNMENT also ok (or even better?) + x = "error" y = "error" z = "error" } diff --git a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierCheckerForInnerComponents.kt b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierCheckerForInnerComponents.kt index e93414a8368..4b80b826252 100644 --- a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierCheckerForInnerComponents.kt +++ b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantVisibilityModifierCheckerForInnerComponents.kt @@ -73,5 +73,5 @@ class B5 : A5() { } fun test5() { - B5().attribute = "c" + B5().attribute = "c" } diff --git a/compiler/fir/analysis-tests/testData/resolve/kt54775.kt b/compiler/fir/analysis-tests/testData/resolve/kt54775.kt index 561e9e930d6..a41b10bab24 100644 --- a/compiler/fir/analysis-tests/testData/resolve/kt54775.kt +++ b/compiler/fir/analysis-tests/testData/resolve/kt54775.kt @@ -2,7 +2,7 @@ fun bar(): T { return null as T } -class X() : B by get() = bar() { - val prop = bar() = 2 +class X() : B by get() = bar() { + val prop = bar() = 2 } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.fir.txt new file mode 100644 index 00000000000..7398c72c3da --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.fir.txt @@ -0,0 +1,24 @@ +FILE: assignmentWithWrongLhs.kt + public final fun foo(): R|kotlin/Int| { + ^foo Int(1) + } + public final fun test(): R|kotlin/Unit| { + R|/foo|() = Int(1) + R|/foo|().R|kotlin/Int.toString|() = Int(1) + when () { + Boolean(true) -> { + R|/foo|() + } + else -> { + Int(1) + } + } + = String() + R|kotlin/run|( = run@fun (): R|kotlin/Unit| { + R|kotlin/io/print|(String(To string)).R|kotlin/also|( = also@fun (it: R|kotlin/Unit|): R|kotlin/Unit| { + R|kotlin/io/print|(R|/it|) + } + ) + } + ) = Int(1) + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.kt new file mode 100644 index 00000000000..d314a57b7c6 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.kt @@ -0,0 +1,10 @@ +fun foo(): Int = 1 + +fun test() { + foo() = 1 + foo().toString() = 1 + (if (true) foo() else 1) = "" + run { + print("To string").also { print(it) } + } = 1 +} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/hashSet.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/hashSet.fir.txt index ec5bc94ad99..fa5047ffc78 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/hashSet.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/hashSet.fir.txt @@ -18,5 +18,5 @@ FILE: hashSet.kt public final fun foo(): R|kotlin/Unit| { lvar c: R|kotlin/collections/MutableSet?| = Null(null) R|/c| = R|java/util/HashSet.HashSet|() - R|/c|!!.R|/d| = R|/produce|() + R|/c|!!.R|/d| = R|/produce|() } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.fir.txt index bcce2c302ae..3f02591a24d 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.fir.txt @@ -1,10 +1,10 @@ FILE: listPlusAssign.kt public final fun R|kotlin/collections/List|.modify(): R|kotlin/Unit| { - # = this@R|/modify|.R|kotlin/collections/plus|(String(Alpha)) - # = this@R|/modify|.R|kotlin/collections/plus|(String(Omega)) + this@R|/modify| = this@R|/modify|.R|kotlin/collections/plus|(String(Alpha)) + this@R|/modify| = this@R|/modify|.R|kotlin/collections/plus|(String(Omega)) } public final fun R|kotlin/Any|.modify(): R|kotlin/Unit| { - # = (this@R|/modify| as R|kotlin/collections/List|).R|kotlin/collections/plus|(Int(42)) + (this@R|/modify| as R|kotlin/collections/List|) = (this@R|/modify| as R|kotlin/collections/List|).R|kotlin/collections/plus|(Int(42)) } public final operator fun R|kotlin/collections/Set|.plusAssign(x: R|T|): R|kotlin/Unit| { } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt index 7302d4f99e8..7e6203fa6d0 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/listPlusAssign.kt @@ -1,8 +1,8 @@ // COMPARE_WITH_LIGHT_TREE fun List.modify() { - this += "Alpha" - this += "Omega" + this += "Alpha" + this += "Omega" } fun Any.modify() { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java index dd7d7b55753..f93ce2c6db8 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java @@ -4630,6 +4630,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayInLocal.kt"); } + @Test + @TestMetadata("assignmentWithWrongLhs.kt") + public void testAssignmentWithWrongLhs() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.kt"); + } + @Test @TestMetadata("backingField.kt") public void testBackingField() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java index cdf17431ed6..3c2b013cdf4 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java @@ -4630,6 +4630,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/arrayInLocal.kt"); } + @Test + @TestMetadata("assignmentWithWrongLhs.kt") + public void testAssignmentWithWrongLhs() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/assignmentWithWrongLhs.kt"); + } + @Test @TestMetadata("backingField.kt") public void testBackingField() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 16c14a9deb8..c2326036ab8 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -4174,6 +4174,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/cast/AsInBlockWithReturnType.kt"); } + @Test + @TestMetadata("AsInCompoundAssignment.kt") + public void testAsInCompoundAssignment() throws Exception { + runTest("compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt"); + } + @Test @TestMetadata("AsInExpressionBody.kt") public void testAsInExpressionBody() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 8531652e5be..e4db790015e 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -4168,6 +4168,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/cast/AsInBlockWithReturnType.kt"); } + @Test + @TestMetadata("AsInCompoundAssignment.kt") + public void testAsInCompoundAssignment() throws Exception { + runTest("compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt"); + } + @Test @TestMetadata("AsInExpressionBody.kt") public void testAsInExpressionBody() throws Exception { diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.txt index 38bfc3b1881..97ff3dbde80 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.txt @@ -9,5 +9,5 @@ FILE: safeCallsWithAssignment.kt a#?.{ $subj$.b#.get#(IntegerLiteral(0)).set#(IntegerLiteral(0), IntegerLiteral(1)) } a#?.{ $subj$.b# }?.{ $subj$.c#.get#(IntegerLiteral(0)).set#(IntegerLiteral(0), IntegerLiteral(1)) } a#?.{ $subj$.b# }.c#.get#(IntegerLiteral(0)).set#(IntegerLiteral(0), IntegerLiteral(1)) - a#?.{ $subj$.b# }.d# = IntegerLiteral(1) + a#?.{ $subj$.b# }.d#() = IntegerLiteral(1) } diff --git a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt index 85221854513..389ff624dca 100644 --- a/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt +++ b/compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.txt @@ -62,7 +62,7 @@ FILE: safeCallsWithUnaryOperators.kt R|/| lval : = a#?.{ $subj$.b# } lval : = R|/|.d#() - R|/|.d# = R|/|.inc#() + R|/|.d#() = R|/|.inc#() R|/| } public? final? fun foo2(): R|kotlin/Unit| { @@ -128,6 +128,6 @@ FILE: safeCallsWithUnaryOperators.kt R|/| lval : = a#?.{ $subj$.b# } lval : = R|/|.d#().inc#() - R|/|.d# = R|/| + R|/|.d#() = R|/| R|/| } diff --git a/compiler/testData/cli/jvm/firLightTreeOff.out b/compiler/testData/cli/jvm/firLightTreeOff.out index a3ad11a2ed7..5119a334a5b 100644 --- a/compiler/testData/cli/jvm/firLightTreeOff.out +++ b/compiler/testData/cli/jvm/firLightTreeOff.out @@ -5,4 +5,10 @@ compiler/testData/cli/jvm/firLightTree.kt:2:5: error: variable expected compiler/testData/cli/jvm/firLightTree.kt:3:15: error: classifier 'class System : Any' does not have a companion object, and thus must be initialized here java.lang.System = null ^ +compiler/testData/cli/jvm/firLightTree.kt:3:15: error: variable expected + java.lang.System = null + ^ +compiler/testData/cli/jvm/firLightTree.kt:3:24: error: null can not be a value of a non-null type + java.lang.System = null + ^ COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/firLightTreeOn.out b/compiler/testData/cli/jvm/firLightTreeOn.out index 59523eeb47b..5119a334a5b 100644 --- a/compiler/testData/cli/jvm/firLightTreeOn.out +++ b/compiler/testData/cli/jvm/firLightTreeOn.out @@ -1,5 +1,14 @@ warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features -compiler/testData/cli/jvm/firLightTree.kt:3:5: error: classifier 'class System : Any' does not have a companion object, and thus must be initialized here - java.lang.System = null +compiler/testData/cli/jvm/firLightTree.kt:2:5: error: variable expected + this += "Alpha" ^ +compiler/testData/cli/jvm/firLightTree.kt:3:15: error: classifier 'class System : Any' does not have a companion object, and thus must be initialized here + java.lang.System = null + ^ +compiler/testData/cli/jvm/firLightTree.kt:3:15: error: variable expected + java.lang.System = null + ^ +compiler/testData/cli/jvm/firLightTree.kt:3:24: error: null can not be a value of a non-null type + java.lang.System = null + ^ COMPILATION_ERROR diff --git a/compiler/testData/diagnostics/tests/LValueAssignment.fir.kt b/compiler/testData/diagnostics/tests/LValueAssignment.fir.kt index 72439f3e772..e02d3a17c02 100644 --- a/compiler/testData/diagnostics/tests/LValueAssignment.fir.kt +++ b/compiler/testData/diagnostics/tests/LValueAssignment.fir.kt @@ -45,8 +45,8 @@ fun cannotBe() { "" = ""; foo() = Unit; - (i as Int) = 34 - (i is Int) = false + (i as Int) = 34 + (i is Int) = false A() = A() 5 = 34 } diff --git a/compiler/testData/diagnostics/tests/OverridenSetterVisibility.fir.kt b/compiler/testData/diagnostics/tests/OverridenSetterVisibility.fir.kt new file mode 100644 index 00000000000..f68faaaa50f --- /dev/null +++ b/compiler/testData/diagnostics/tests/OverridenSetterVisibility.fir.kt @@ -0,0 +1,29 @@ +public interface ITest { + public var prop : Int + get() = 12 + set(value) {} +} + +abstract class ATest { + protected open var prop2 : Int + get() = 13 + set(value) {} +} + +class Test: ATest(), ITest { + override var prop : Int + get() = 12 + private set(value) {} + + override var prop2 : Int + get() = 14 + internal set(value) {} +} + +fun main() { + val test = Test() + test.prop = 12 + + val itest: ITest = test + itest.prop = 12 // No error here +} diff --git a/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt b/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt index 58df8486b5e..b0faa7dcb3d 100644 --- a/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt +++ b/compiler/testData/diagnostics/tests/OverridenSetterVisibility.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL public interface ITest { public var prop : Int get() = 12 diff --git a/compiler/testData/diagnostics/tests/PackageInExpressionPosition.fir.kt b/compiler/testData/diagnostics/tests/PackageInExpressionPosition.fir.kt index 11456837617..418c04559bc 100644 --- a/compiler/testData/diagnostics/tests/PackageInExpressionPosition.fir.kt +++ b/compiler/testData/diagnostics/tests/PackageInExpressionPosition.fir.kt @@ -14,10 +14,10 @@ val xssss = foo val f = { System } fun main() { - java = null - System = null + java = null + System = null System!! - java.lang.System = null + java.lang.System = null java.lang.System!! System is Int System() diff --git a/compiler/testData/diagnostics/tests/callableReference/unsupported/localVariableWithSubstitution.fir.kt b/compiler/testData/diagnostics/tests/callableReference/unsupported/localVariableWithSubstitution.fir.kt index c1ae03c3a3f..79d8908578e 100644 --- a/compiler/testData/diagnostics/tests/callableReference/unsupported/localVariableWithSubstitution.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/unsupported/localVariableWithSubstitution.fir.kt @@ -9,6 +9,6 @@ class Foo { fun main() { val f = Foo() val a: Int - get() = f.getValue(null, ::a) // no exception after fix + get() = f.getValue(null, ::a) // no exception after fix print(a) } diff --git a/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.fir.kt b/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.fir.kt index a59813ccbe6..88f7ab02b58 100644 --- a/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/unsupported/parameterWithSubstitution.fir.kt @@ -9,6 +9,6 @@ class Foo { fun main(x: Int) { val f = Foo() val a: Int - get() = f.getValue(null, ::x) // no exception after fix + get() = f.getValue(null, ::x) // no exception after fix print(a) } diff --git a/compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt b/compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt new file mode 100644 index 00000000000..68ca54209cf --- /dev/null +++ b/compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt @@ -0,0 +1,8 @@ +// FIR_IDENTICAL +class A { + var b = 1 +} + +fun Any.test() { + (this as A).b += 1 as Int +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.txt b/compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.txt new file mode 100644 index 00000000000..607545c927d --- /dev/null +++ b/compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.txt @@ -0,0 +1,11 @@ +package + +public fun kotlin.Any.test(): kotlin.Unit + +public final class A { + public constructor A() + public final var b: kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt index 7f61c231d27..c8c711c8b1c 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt @@ -104,6 +104,21 @@ fun t5() { } } +fun t6() { + val i = 0 + fun t5() { + i += 3 + } +} + +fun t7() { + for (i in 0..2) { + fun t5() { + i = 3 + } + } +} + // ------------------------------------------------ // backing fields diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt index b261a0f4a1e..6fa04389dc2 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt @@ -104,6 +104,21 @@ fun t5() { } } +fun t6() { + val i = 0 + fun t5() { + i += 3 + } +} + +fun t7() { + for (i in 0..2) { + fun t5() { + i = 3 + } + } +} + // ------------------------------------------------ // backing fields diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt index 2f9f76caf35..8538301c79a 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.txt @@ -16,6 +16,8 @@ package uninitialized_reassigned_variables { public fun t4(): kotlin.Unit public fun t4(/*0*/ a: uninitialized_reassigned_variables.A): kotlin.Unit public fun t5(): kotlin.Unit + public fun t6(): kotlin.Unit + public fun t7(): kotlin.Unit public fun test(/*0*/ m: uninitialized_reassigned_variables.M): kotlin.Unit public fun test1(/*0*/ m: uninitialized_reassigned_variables.M): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt index 23e18692ae9..62566e25c37 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt @@ -23,23 +23,23 @@ class P { fun foo() { val p = P() - p.x = 34 //should be an error here + p.x = 34 //should be an error here p.y = 23 fun inner() { - p.x = 44 + p.x = 44 } } class R { val p = P(); init { - p.x = 42 + p.x = 42 } val testInGetterInOtherClass : Int get() { - p.x = 33 + p.x = 33 return 3 } } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.fir.kt new file mode 100644 index 00000000000..9a1e6eceaa6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.fir.kt @@ -0,0 +1,36 @@ +//KT-2960 Perform control flow checks for package property initializers + +package b + +class P { + var x : Int = 0 + private set +} + +val p = P() +var f = { -> p.x = 32 } + +val o = object { + fun run() { + p.x = 4 + + val z : Int + doSmth(z) + } +} + +val g = { -> + val x: Int + doSmth(x) +} + +class A { + val a : Int = 1 + get() { + val x : Int + doSmth(x) + return field + } +} + +fun doSmth(i: Int) = i diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.kt index ff06fda7566..0fe3c4ad18d 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2960.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL //KT-2960 Perform control flow checks for package property initializers package b @@ -34,4 +33,4 @@ class A { } } -fun doSmth(i: Int) = i \ No newline at end of file +fun doSmth(i: Int) = i diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.fir.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.fir.kt new file mode 100644 index 00000000000..93a637810bb --- /dev/null +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.fir.kt @@ -0,0 +1,30 @@ +// !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_PARAMETER +// !CHECK_TYPE +// t is unused due to KT-4233 + +// FILE: test.kt + +interface Tr { + var v: T +} + +fun test(t: Tr<*>) { + t.v = null!! + t.v = "" + t.v = null + t.v checkType { _() } +} + +fun test2(t: JavaClass<*>) { + t.v = null!! + t.v = "" + t.v = null + t.v checkType { _() } +} + +// FILE: JavaClass.java + +public interface JavaClass { + public T getV(); + public void setV(T v); +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.kt index ca08a5c40ee..c287e02cadf 100644 --- a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.kt +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.kt @@ -1,7 +1,9 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNREACHABLE_CODE -UNUSED_PARAMETER // !CHECK_TYPE // t is unused due to KT-4233 + +// FILE: test.kt + interface Tr { var v: T } @@ -11,4 +13,18 @@ fun test(t: Tr<*>) { t.v = "" t.v = null t.v checkType { _() } -} \ No newline at end of file +} + +fun test2(t: JavaClass<*>) { + t.v = null!! + t.v = "" + t.v = null + t.v checkType { _() } +} + +// FILE: JavaClass.java + +public interface JavaClass { + public T getV(); + public void setV(T v); +} diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.txt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.txt index 9a643c1414d..5533f2ce5a2 100644 --- a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.txt +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutAssign.txt @@ -1,6 +1,15 @@ package public fun test(/*0*/ t: Tr<*>): kotlin.Unit +public fun test2(/*0*/ t: JavaClass<*>): kotlin.Unit + +public interface JavaClass { + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public abstract fun getV(): T! + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public abstract fun setV(/*0*/ v: T!): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} public interface Tr { public abstract var v: T diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.fir.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.fir.kt new file mode 100644 index 00000000000..108e8147295 --- /dev/null +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.fir.kt @@ -0,0 +1,10 @@ +// !DIAGNOSTICS: -UNREACHABLE_CODE +interface Tr { + var v: T +} + +fun test(t: Tr) { + // resolved as t.v = t.v + null!!, where type of right operand is String, + // so TYPE_MISMATCH: String is not <: of Captured(out String) + t.v += null!! +} diff --git a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.kt b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.kt index fd237dcebb1..2286eec55e0 100644 --- a/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.kt +++ b/compiler/testData/diagnostics/tests/generics/varProjection/setterProjectedOutNoPlusAssign.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !DIAGNOSTICS: -UNREACHABLE_CODE interface Tr { var v: T @@ -8,4 +7,4 @@ fun test(t: Tr) { // resolved as t.v = t.v + null!!, where type of right operand is String, // so TYPE_MISMATCH: String is not <: of Captured(out String) t.v += null!! -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt index 407314031be..ac1c9d47ce0 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727.fir.kt @@ -43,7 +43,7 @@ public class Bar { } fun takeStarBar(x: Bar<*>) { - x.value = "test" + x.value = "test" x.value += "test" } @@ -74,7 +74,7 @@ public class Bar2 { } fun takeStarBar2(x: Bar2<*>) { - x.value = "test" + x.value = "test" x.value += "test" } @@ -106,7 +106,7 @@ class Bar3 { } fun takeStarBar3(x: Bar3<*>) { - x.value = "test" + x.value = "test" x.value += "test" } diff --git a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt index 24d87366bde..b8c2d5ef661 100644 --- a/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/capturedTypes/kt46727Warnings.fir.kt @@ -43,7 +43,7 @@ public class Bar { } fun takeStarBar(x: Bar<*>) { - x.value = "test" + x.value = "test" x.value += "test" } @@ -74,7 +74,7 @@ public class Bar2 { } fun takeStarBar2(x: Bar2<*>) { - x.value = "test" + x.value = "test" x.value += "test" } @@ -106,7 +106,7 @@ class Bar3 { } fun takeStarBar3(x: Bar3<*>) { - x.value = "test" + x.value = "test" x.value += "test" } diff --git a/compiler/testData/diagnostics/tests/properties/kt47621.fir.kt b/compiler/testData/diagnostics/tests/properties/kt47621.fir.kt deleted file mode 100644 index e603263149d..00000000000 --- a/compiler/testData/diagnostics/tests/properties/kt47621.fir.kt +++ /dev/null @@ -1,23 +0,0 @@ -// WITH_STDLIB - -// FILE: j/J.java -package j; - -public class J { - public int getX() { return 1; } - protected void setX(int value) { throw new RuntimeException(); } -} - -// FILE: main.kt -import j.* - -class C : J() { - fun foo() { - J()?.x = 1 - } -} - -fun box(): String { - C().foo() - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/properties/kt47621.kt b/compiler/testData/diagnostics/tests/properties/kt47621.kt index 96c252c73f3..66631b0a3eb 100644 --- a/compiler/testData/diagnostics/tests/properties/kt47621.kt +++ b/compiler/testData/diagnostics/tests/properties/kt47621.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // WITH_STDLIB // FILE: j/J.java diff --git a/compiler/testData/diagnostics/tests/protectedWithGenericsInDifferentPackage.fir.kt b/compiler/testData/diagnostics/tests/protectedWithGenericsInDifferentPackage.fir.kt index f85098d585c..0fe32c505bd 100644 --- a/compiler/testData/diagnostics/tests/protectedWithGenericsInDifferentPackage.fir.kt +++ b/compiler/testData/diagnostics/tests/protectedWithGenericsInDifferentPackage.fir.kt @@ -26,9 +26,9 @@ package foo fun test(s: bar.Sub) { s.name - s.name = "" + s.name = "" s.name2 - s.name2 = "" + s.name2 = "" s.doSomething() s.doSomething2() val s2: Super = s diff --git a/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.fir.kt b/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.fir.kt index cfcc8567b3a..1a4be16bbdd 100644 --- a/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/HiddenDeclarations.fir.kt @@ -41,7 +41,7 @@ open class A { fun foo() { topLevelFun() topLevelFun(1) - topLevelProperty++ + topLevelProperty++ "".topLevelExtensionFun() 1.topLevelExtensionFun() "".topLevelExtensionProperty diff --git a/compiler/testData/diagnostics/tests/resolve/dslMarker/properties.fir.kt b/compiler/testData/diagnostics/tests/resolve/dslMarker/properties.fir.kt index 2fa63805707..ba521b4d4cd 100644 --- a/compiler/testData/diagnostics/tests/resolve/dslMarker/properties.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/dslMarker/properties.fir.kt @@ -35,12 +35,12 @@ fun test() { bar { a + 1 - a += a + 1 - a++ + a += a + 1 + a++ a1 + 1 - a1 += a1 + 1 - a1++ + a1 += a1 + 1 + a1++ this@foo.a + 1 this@foo.a += this@foo.a + 1 diff --git a/compiler/testData/diagnostics/tests/resolve/noCandidates/resolvedToClassifier.fir.kt b/compiler/testData/diagnostics/tests/resolve/noCandidates/resolvedToClassifier.fir.kt index 5dbb1db3619..7c72da80486 100644 --- a/compiler/testData/diagnostics/tests/resolve/noCandidates/resolvedToClassifier.fir.kt +++ b/compiler/testData/diagnostics/tests/resolve/noCandidates/resolvedToClassifier.fir.kt @@ -24,7 +24,7 @@ fun bar() { B::class.equals(T) - T = "" + T = "" } fun baz(a: Any) {} diff --git a/compiler/testData/diagnostics/tests/scopes/invisibleSetter.fir.kt b/compiler/testData/diagnostics/tests/scopes/invisibleSetter.fir.kt new file mode 100644 index 00000000000..e6a89ccb195 --- /dev/null +++ b/compiler/testData/diagnostics/tests/scopes/invisibleSetter.fir.kt @@ -0,0 +1,9 @@ +class A { + public var x: Int = 0 + private set +} + +fun main() { + val a = A() + a.x = 1 +} diff --git a/compiler/testData/diagnostics/tests/scopes/invisibleSetter.kt b/compiler/testData/diagnostics/tests/scopes/invisibleSetter.kt index 95ff8ee22fd..7d05e771cff 100644 --- a/compiler/testData/diagnostics/tests/scopes/invisibleSetter.kt +++ b/compiler/testData/diagnostics/tests/scopes/invisibleSetter.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL class A { public var x: Int = 0 private set @@ -7,4 +6,4 @@ class A { fun main() { val a = A() a.x = 1 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt index 6d950a84b51..ea017d6e151 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt @@ -8,6 +8,6 @@ class A { class B() { init { - A().a = "Hello" + A().a = "Hello" } } diff --git a/compiler/testData/diagnostics/tests/scopes/kt1738.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt1738.fir.kt index 39132619682..bea22005df0 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1738.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1738.fir.kt @@ -6,6 +6,6 @@ class A(private var i: Int, var j: Int) { } fun test(a: A) { - a.i++ + a.i++ a.j++ } diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/syntheticPropertyExtensions.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/syntheticPropertyExtensions.fir.kt index 286d569e69e..1376a2aab0a 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/syntheticPropertyExtensions.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/syntheticPropertyExtensions.fir.kt @@ -22,7 +22,7 @@ class B : A() { b.bar = b.bar + "" a.foo - a.bar = a.bar + "" + a.bar = a.bar + "" if (a is B) { a.foo @@ -32,12 +32,12 @@ class B : A() { if (d.x is B) { d.x.abc // Ok d.x.foo - d.x.bar = d.x.bar + "" + d.x.bar = d.x.bar + "" } } } fun baz(a: A) { a.foo - a.bar = a.bar + "" + a.bar = a.bar + "" } diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/withSmartcast.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/withSmartcast.fir.kt index b358649a964..0b9cea0fc54 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/withSmartcast.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/withSmartcast.fir.kt @@ -14,8 +14,8 @@ class Derived : Base() { x.foo() x.bar() - x.x = x.x + 1 - x.y = x.y + 1 + x.x = x.x + 1 + x.y = x.y + 1 if (x is Derived) { x.foo() diff --git a/compiler/testData/diagnostics/tests/scopes/visibility.fir.kt b/compiler/testData/diagnostics/tests/scopes/visibility.fir.kt index fe7dae5c797..896ae1e4879 100644 --- a/compiler/testData/diagnostics/tests/scopes/visibility.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/visibility.fir.kt @@ -54,7 +54,7 @@ open class C : T { } fun test4(c: C) { - c.i++ + c.i++ } class D : C() { diff --git a/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.fir.kts b/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.fir.kts index 9db5f318b4b..8e843c0640a 100644 --- a/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.fir.kts +++ b/compiler/testData/diagnostics/tests/script/topLevelPropertiesWithGetSet.fir.kts @@ -17,10 +17,10 @@ val testValLineBreakNoType get() = 42 val testValLineBreakSemi: Int; -get() = 42 +get() = 42 val testValLineBreakSemiNoType; -get() = 42 +get() = 42 var testVarLineBreak: Int get() = 42 @@ -31,9 +31,9 @@ get() = 42 set(value) {} var testVarLineBreakSemi: Int; -get() = 42 +get() = 42 set(value) {} var String.testExtVarLineBreakSemi: Int; -get() = 42 +get() = 42 set(value) {} diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.fir.kt index dfda95bed2c..bc2f63a8fe8 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/OnlyPublic.fir.kt @@ -8,7 +8,7 @@ fun foo(javaClass: JavaClass) { javaClass.somethingProtected javaClass.somethingPrivate javaClass.somethingPackage - javaClass.somethingPublic = 1 + javaClass.somethingPublic = 1 } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.fir.kt b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.fir.kt index aa794ecb83e..69ad48ede2c 100644 --- a/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.fir.kt +++ b/compiler/testData/diagnostics/tests/syntheticExtensions/javaProperties/SetterHasHigherAccess.fir.kt @@ -6,7 +6,7 @@ import JavaClass fun foo(javaClass: JavaClass) { val v = javaClass.something javaClass.something = 1 - javaClass.something++ + javaClass.something++ } // FILE: JavaClass.java diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt index 9b7d0d47a74..f2176354448 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt @@ -15,23 +15,23 @@ class Test { this.i = getT() with(Test()) { i = getT() // resolved to this@Test.i - this.i = getT() - this@with.i = getT() + this.i = getT() + this@with.i = getT() this@Test.i = getT() } } fun test(t: Test) { - t.i = getT() + t.i = getT() } companion object { fun test(t: Test) { - t.i = getT() + t.i = getT() } } } fun test(t: Test) { - t.i = getT() + t.i = getT() } diff --git a/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.fir.kt b/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.fir.kt index f4b5a37cda9..7d171bbfba9 100644 --- a/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.fir.kt +++ b/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClass.fir.kt @@ -18,12 +18,12 @@ class Data(var x: Foo) class B : Foo() { fun baz(a: Foo, t: Foo, d: Data) { - a.bar = t.bar - a.foo = t.foo + a.bar = t.bar + a.foo = t.foo if (d.x is B) { - d.x.bar = d.x.bar + "" - d.x.foo = d.x.foo + "" + d.x.bar = d.x.bar + "" + d.x.foo = d.x.foo + "" } } } diff --git a/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.fir.kt b/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.fir.kt index 90ec72a9356..49ade474c72 100644 --- a/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.fir.kt +++ b/compiler/testData/diagnostics/tests/visibility/invisibleSetterOfJavaClassWithDisabledFeature.fir.kt @@ -19,11 +19,11 @@ class Data(var x: Foo) class B : Foo() { fun baz(a: Foo, t: Foo, d: Data) { a.bar = t.bar - a.foo = t.foo + a.foo = t.foo if (d.x is B) { d.x.bar = d.x.bar + "" - d.x.foo = d.x.foo + "" + d.x.foo = d.x.foo + "" } } } diff --git a/compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.fir.kt b/compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.fir.kt index 8d6b426f6db..21d37b8411b 100644 --- a/compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.fir.kt +++ b/compiler/testData/diagnostics/tests/visibility/lackOfInvisibleSetterOfJavaClassInSamePackage.fir.kt @@ -13,11 +13,11 @@ class Data(var x: Foo) class B : Foo() { fun baz(a: Foo, t: Foo, d: Data) { a.bar = t.bar - a.foo = t.foo + a.foo = t.foo if (d.x is B) { d.x.bar = d.x.bar + "" - d.x.foo = d.x.foo + "" + d.x.foo = d.x.foo + "" } } } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt index dfdcf247720..9c9af6b6873 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt @@ -12,10 +12,10 @@ fun main(arg: Any) { run { a; this }.a = 10 a += 1 this.a = 57 - this.(a) = 57 + this.(a) = 57 a = x (a) = x - a.hashCode = 99 + a.hashCode = 99 if (arg is String) { a = arg } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 41bc082b06f..0487c053646 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -4174,6 +4174,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/cast/AsInBlockWithReturnType.kt"); } + @Test + @TestMetadata("AsInCompoundAssignment.kt") + public void testAsInCompoundAssignment() throws Exception { + runTest("compiler/testData/diagnostics/tests/cast/AsInCompoundAssignment.kt"); + } + @Test @TestMetadata("AsInExpressionBody.kt") public void testAsInExpressionBody() throws Exception { diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt index 8446fb9e937..2fe706f4dfe 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.fir.kt @@ -54,5 +54,5 @@ fun case3() { fun case4() { for (x in 1..2) {} = TODO(); - while (false) { } = TODO() + while (false) { } = TODO() } diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt index 43c48695e29..8591618ac42 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.fir.kt @@ -9,7 +9,7 @@ fun case1() { val x : Case1? = Case1() x.x = "0" x?.x = "0" - x::x = TODO() + x::x = TODO() } class Case1{ @@ -25,7 +25,7 @@ fun case2() { val x : Case2? = Case2(null) x.x = "0" x?.x = "0" - x::x = TODO() + x::x = TODO() } class Case2(val x: Any?) {} @@ -38,7 +38,7 @@ fun case3() { val x : Case3? = Case3() x.x = "0" x?.x = "0" - x::x = TODO() + x::x = TODO() } class Case3() { diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt index b20c22627ce..60eb14b4ef9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt @@ -5,7 +5,7 @@ fun case_1() { var x: Int? = 11 x!! - try {x = null;} finally { x += 10; } + try {x = null;} finally { x += 10; } } // TESTCASE NUMBER: 2