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 daec6955089..61fe508a067 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 @@ -501,6 +501,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/kt56665.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/diagnostics/tests/kt56723.kt"); + } + @Test @TestMetadata("LValueAssignment.kt") public void testLValueAssignment() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 94f0d939213..da1a4246461 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -501,6 +501,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/kt56665.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/diagnostics/tests/kt56723.kt"); + } + @Test @TestMetadata("LValueAssignment.kt") public void testLValueAssignment() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 06ac6458cb7..7be928245a3 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -501,6 +501,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/kt56665.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/diagnostics/tests/kt56723.kt"); + } + @Test @TestMetadata("LValueAssignment.kt") public void testLValueAssignment() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index 12254913d94..9d287524b36 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -50813,6 +50813,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 11750accbaf..0a4fd158bbb 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -50813,6 +50813,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index 1c1ea82c42e..e901f7c954f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -49,8 +49,8 @@ import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability import org.jetbrains.kotlin.types.ConstantValueKind import org.jetbrains.kotlin.types.SmartcastStability import org.jetbrains.kotlin.types.model.safeSubstitute +import org.jetbrains.kotlin.util.OperatorNameConventions import org.jetbrains.kotlin.utils.addIfNotNull -import org.jetbrains.kotlin.utils.addToStdlib.runIf import kotlin.contracts.ExperimentalContracts import kotlin.contracts.contract @@ -498,31 +498,38 @@ fun FirSafeCallExpression.propagateTypeFromQualifiedAccessAfterNullCheck( file: FirFile, ) { val receiverType = nullableReceiverExpression.typeRef.coneTypeSafe() - val typeAfterNullCheck = selector.expressionTypeOrUnitForAssignment() ?: return - val isReceiverActuallyNullable = if (session.languageVersionSettings.supportsFeature(LanguageFeature.SafeCallsAreAlwaysNullable)) { - true - } else { - receiverType != null && session.typeContext.run { receiverType.isNullableType() } + val selector = selector + + val resultingType = when { + selector is FirExpression && !selector.isCallToStatementLikeFunction -> { + val type = selector.typeRef.coneTypeSafe() ?: return + + val isReceiverActuallyNullable = session.languageVersionSettings.supportsFeature(LanguageFeature.SafeCallsAreAlwaysNullable) + || receiverType != null && session.typeContext.run { receiverType.isNullableType() } + + if (isReceiverActuallyNullable) { + type.withNullability(ConeNullability.NULLABLE, session.typeContext) + } else { + type + } + } + // Branch for things that shouldn't be used as expressions. + // They are forced to return not-null `Unit`, regardless of the receiver. + else -> { + StandardClassIds.Unit.constructClassLikeType(emptyArray(), isNullable = false) + } } - val resultingType = - if (isReceiverActuallyNullable) - typeAfterNullCheck.withNullability(ConeNullability.NULLABLE, session.typeContext) - else - typeAfterNullCheck val resolvedTypeRef = typeRef.resolvedTypeFromPrototype(resultingType) replaceTypeRef(resolvedTypeRef) session.lookupTracker?.recordTypeResolveAsLookup(resolvedTypeRef, source, file.source) } -private fun FirStatement.expressionTypeOrUnitForAssignment(): ConeKotlinType? { - if (this is FirExpression) return typeRef.coneTypeSafe() - - require(this is FirVariableAssignment) { - "The only non-expression FirQualifiedAccess is FirVariableAssignment, but ${this::class} was found" +private val FirExpression.isCallToStatementLikeFunction: Boolean + get() { + val symbol = (this as? FirFunctionCall)?.calleeReference?.toResolvedFunctionSymbol() ?: return false + return origin == FirFunctionCallOrigin.Operator && symbol.name in OperatorNameConventions.STATEMENT_LIKE_OPERATORS } - return StandardClassIds.Unit.constructClassLikeType(emptyArray(), isNullable = false) -} fun FirAnnotation.getCorrespondingClassSymbolOrNull(session: FirSession): FirRegularClassSymbol? { return annotationTypeRef.coneType.fullyExpandedType(session).classId?.let { diff --git a/compiler/testData/codegen/box/unit/kt56723.kt b/compiler/testData/codegen/box/unit/kt56723.kt new file mode 100644 index 00000000000..140a358a5ef --- /dev/null +++ b/compiler/testData/codegen/box/unit/kt56723.kt @@ -0,0 +1,27 @@ +fun foo(f: () -> Unit, returnIfOk: String): String { + val string = f().toString() + + return if (string == "kotlin.Unit") { + returnIfOk + } else { + "FAIL: $string;" + } +} + +class Wrapper(var s: String) + +fun box(): String { + val w: Wrapper? = Wrapper("Test") + + val lambda = { + w?.s = "X" + } + + val w2: Wrapper? = null + + val lambda2 = { + w2?.s = "X" + } + + return foo(lambda, "O") + foo(lambda2, "K") +} diff --git a/compiler/testData/diagnostics/tests/kt56723.fir.kt b/compiler/testData/diagnostics/tests/kt56723.fir.kt new file mode 100644 index 00000000000..2ec89466262 --- /dev/null +++ b/compiler/testData/diagnostics/tests/kt56723.fir.kt @@ -0,0 +1,91 @@ +import kotlin.reflect.KProperty + +fun foo(f: () -> Unit) { + f() +} + +class Wrapper(var s: String) + +fun bar(w: Wrapper?) { + // K1: type is () -> Unit, K2: type is () -> Unit? + val lambda = { + w?.s = "X" + } + // K1: Ok, K2: ARGUMENT_TYPE_MISMATCH + foo(lambda) +} + +class Wrapper2(val w: Wrapper?) + +fun baz(w2: Wrapper2?) { + val lambda = { + w2?.w?.s = "X" + } + foo(lambda) +} + +object Indexible { + operator fun get(index: Int) = "$index" + operator fun set(index: Int, value: String) {} +} +class IndexibleRef(val ind: Indexible) +class IndexibleRefRef(val ref: IndexibleRef?) + +fun ban(refRef: IndexibleRefRef?, ref: IndexibleRef?) { + val lambda = { + ref?.ind[1] = "X" + } + foo(lambda) + + val lambda2 = { + refRef?.ref?.ind[1] = "X" + } + foo(lambda2) + + val lambda3 = { + ref?.ind?.set(1, "X") + } + foo(lambda3) + + val lambda4 = { + refRef?.ref?.ind?.set(1, "X") + } + foo(lambda4) +} + +object PlusAssignable { + operator fun plusAssign(index: Int) {} +} + +object Indexible2 { + operator fun get(index: Int) = PlusAssignable + operator fun set(index: Int, value: String) {} +} + +class Indexible2Ref(val ind: Indexible2) + +fun bam(ref: Indexible2Ref?) { + val lambda = { + ref?.ind[1] += 1 + } + foo(lambda) + + val lambd2 = { + ref?.ind?.get(1)?.plusAssign(1) + } + foo(lambda) +} + +class DelegatedHolder { + var delegated by object { + operator fun getValue(thisRef: Any?, desc: KProperty<*>) = "test" + operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: String) {} + } +} + +fun bap(holder: DelegatedHolder?) { + val lambda = { + holder?.delegated = "Y" + } + foo(lambda) +} diff --git a/compiler/testData/diagnostics/tests/kt56723.kt b/compiler/testData/diagnostics/tests/kt56723.kt new file mode 100644 index 00000000000..4b32ba7c2c0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/kt56723.kt @@ -0,0 +1,91 @@ +import kotlin.reflect.KProperty + +fun foo(f: () -> Unit) { + f() +} + +class Wrapper(var s: String) + +fun bar(w: Wrapper?) { + // K1: type is () -> Unit, K2: type is () -> Unit? + val lambda = { + w?.s = "X" + } + // K1: Ok, K2: ARGUMENT_TYPE_MISMATCH + foo(lambda) +} + +class Wrapper2(val w: Wrapper?) + +fun baz(w2: Wrapper2?) { + val lambda = { + w2?.w?.s = "X" + } + foo(lambda) +} + +object Indexible { + operator fun get(index: Int) = "$index" + operator fun set(index: Int, value: String) {} +} +class IndexibleRef(val ind: Indexible) +class IndexibleRefRef(val ref: IndexibleRef?) + +fun ban(refRef: IndexibleRefRef?, ref: IndexibleRef?) { + val lambda = { + ref?.ind[1] = "X" + } + foo(lambda) + + val lambda2 = { + refRef?.ref?.ind[1] = "X" + } + foo(lambda2) + + val lambda3 = { + ref?.ind?.set(1, "X") + } + foo(lambda3) + + val lambda4 = { + refRef?.ref?.ind?.set(1, "X") + } + foo(lambda4) +} + +object PlusAssignable { + operator fun plusAssign(index: Int) {} +} + +object Indexible2 { + operator fun get(index: Int) = PlusAssignable + operator fun set(index: Int, value: String) {} +} + +class Indexible2Ref(val ind: Indexible2) + +fun bam(ref: Indexible2Ref?) { + val lambda = { + ref?.ind[1] += 1 + } + foo(lambda) + + val lambd2 = { + ref?.ind?.get(1)?.plusAssign(1) + } + foo(lambda) +} + +class DelegatedHolder { + var delegated by object { + operator fun getValue(thisRef: Any?, desc: KProperty<*>) = "test" + operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: String) {} + } +} + +fun bap(holder: DelegatedHolder?) { + val lambda = { + holder?.delegated = "Y" + } + foo(lambda) +} diff --git a/compiler/testData/diagnostics/tests/kt56723.txt b/compiler/testData/diagnostics/tests/kt56723.txt new file mode 100644 index 00000000000..f558229f4f9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/kt56723.txt @@ -0,0 +1,83 @@ +package + +public fun bam(/*0*/ ref: Indexible2Ref?): kotlin.Unit +public fun ban(/*0*/ refRef: IndexibleRefRef?, /*1*/ ref: IndexibleRef?): kotlin.Unit +public fun bap(/*0*/ holder: DelegatedHolder?): kotlin.Unit +public fun bar(/*0*/ w: Wrapper?): kotlin.Unit +public fun baz(/*0*/ w2: Wrapper2?): kotlin.Unit +public fun foo(/*0*/ f: () -> kotlin.Unit): kotlin.Unit + +public final class DelegatedHolder { + public constructor DelegatedHolder() + public final var delegated: kotlin.String + 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 +} + +public object Indexible { + private constructor Indexible() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun get(/*0*/ index: kotlin.Int): kotlin.String + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public object Indexible2 { + private constructor Indexible2() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public final operator fun get(/*0*/ index: kotlin.Int): PlusAssignable + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun set(/*0*/ index: kotlin.Int, /*1*/ value: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Indexible2Ref { + public constructor Indexible2Ref(/*0*/ ind: Indexible2) + public final val ind: Indexible2 + 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 +} + +public final class IndexibleRef { + public constructor IndexibleRef(/*0*/ ind: Indexible) + public final val ind: Indexible + 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 +} + +public final class IndexibleRefRef { + public constructor IndexibleRefRef(/*0*/ ref: IndexibleRef?) + public final val ref: IndexibleRef? + 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 +} + +public object PlusAssignable { + private constructor PlusAssignable() + 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 final operator fun plusAssign(/*0*/ index: kotlin.Int): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public final class Wrapper { + public constructor Wrapper(/*0*/ s: kotlin.String) + public final var s: kotlin.String + 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 +} + +public final class Wrapper2 { + public constructor Wrapper2(/*0*/ w: Wrapper?) + public final val w: Wrapper? + 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/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 639b4b37b9a..931a83df48c 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 @@ -501,6 +501,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/kt56665.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/diagnostics/tests/kt56723.kt"); + } + @Test @TestMetadata("LValueAssignment.kt") public void testLValueAssignment() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 5d6d4e012b0..166d72c1992 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -48581,6 +48581,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 366d0b6e351..f3367538c00 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -50813,6 +50813,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 80219aa4aa7..3b6f3fe3c7e 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -39457,6 +39457,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { runTest("compiler/testData/codegen/box/unit/nullableUnit.kt"); diff --git a/core/compiler.common/src/org/jetbrains/kotlin/util/OperatorNameConventions.kt b/core/compiler.common/src/org/jetbrains/kotlin/util/OperatorNameConventions.kt index 5e14b0e163b..0b71bec0fae 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/util/OperatorNameConventions.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/util/OperatorNameConventions.kt @@ -95,4 +95,7 @@ object OperatorNameConventions { @JvmField val MOD_OPERATORS_REPLACEMENT = mapOf(MOD to REM, MOD_ASSIGN to REM_ASSIGN) + + @JvmField + val STATEMENT_LIKE_OPERATORS = setOf(SET) + ASSIGNMENT_OPERATIONS } diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java index babf02186fe..4c5f6fc26a4 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/JsCodegenBoxTestGenerated.java @@ -36013,6 +36013,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index e1130e96b08..8a115743ba2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -36199,6 +36199,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 058e24a5b6d..3472a433098 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -36199,6 +36199,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 48485cfd3e4..980564639b0 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -36199,6 +36199,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java index 9a46937476b..8302d57c400 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/K2NativeCodegenBoxTestGenerated.java @@ -39842,6 +39842,12 @@ public class K2NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTes runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java index 91e7e5d307c..9bb106c8ea1 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/blackboxtest/NativeCodegenBoxTestGenerated.java @@ -39344,6 +39344,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @Test + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @Test @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java index b565c1ee17b..c79c92888f6 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/IrCodegenBoxWasmTestGenerated.java @@ -32422,6 +32422,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest runTest("compiler/testData/codegen/box/unit/kt51036.kt"); } + @TestMetadata("kt56723.kt") + public void testKt56723() throws Exception { + runTest("compiler/testData/codegen/box/unit/kt56723.kt"); + } + @TestMetadata("nullableUnit.kt") public void testNullableUnit() throws Exception { runTest("compiler/testData/codegen/box/unit/nullableUnit.kt");