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 3f8717dd6c3..4f690ca918b 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 @@ -5045,6 +5045,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/integers.kt"); } + @Test + @TestMetadata("invAsCompileTimeCall.kt") + public void testInvAsCompileTimeCall() throws Exception { + runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt"); + } + @Test @TestMetadata("localVal.kt") public void testLocalVal() 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 6bab06d6a59..5697eab7762 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 @@ -5045,6 +5045,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/integers.kt"); } + @Test + @TestMetadata("invAsCompileTimeCall.kt") + public void testInvAsCompileTimeCall() throws Exception { + runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt"); + } + @Test @TestMetadata("localVal.kt") public void testLocalVal() 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 2b0acc4c929..ce06bcb91be 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 @@ -5045,6 +5045,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/integers.kt"); } + @Test + @TestMetadata("invAsCompileTimeCall.kt") + public void testInvAsCompileTimeCall() throws Exception { + runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt"); + } + @Test @TestMetadata("localVal.kt") public void testLocalVal() throws Exception { diff --git a/compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt b/compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt new file mode 100644 index 00000000000..25e79b4e580 --- /dev/null +++ b/compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt @@ -0,0 +1,4 @@ +// FIR_IDENTICAL +// ISSUE: KT-50998 +const val Mask: Int = 0xC0000000.toInt() +const val Mask_Inv: Int = Mask.inv() \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.txt b/compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.txt new file mode 100644 index 00000000000..7311188b2f5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.txt @@ -0,0 +1,4 @@ +package + +public const val Mask: kotlin.Int = -1073741824 +public const val Mask_Inv: kotlin.Int = 1073741823 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 00b9d718c27..de1e916ba39 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 @@ -5051,6 +5051,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/integers.kt"); } + @Test + @TestMetadata("invAsCompileTimeCall.kt") + public void testInvAsCompileTimeCall() throws Exception { + runTest("compiler/testData/diagnostics/tests/constantEvaluator/constant/invAsCompileTimeCall.kt"); + } + @Test @TestMetadata("localVal.kt") public void testLocalVal() throws Exception { 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 5c90f78b444..ae38ec42394 100644 --- a/core/compiler.common/src/org/jetbrains/kotlin/util/OperatorNameConventions.kt +++ b/core/compiler.common/src/org/jetbrains/kotlin/util/OperatorNameConventions.kt @@ -72,10 +72,10 @@ object OperatorNameConventions { // If you add new unary, binary or assignment operators, add it to OperatorConventions as well @JvmField - val UNARY_OPERATION_NAMES = setOf(INC, DEC, UNARY_PLUS, UNARY_MINUS, NOT) + val UNARY_OPERATION_NAMES = setOf(INC, DEC, UNARY_PLUS, UNARY_MINUS, NOT, INV) @JvmField - val SIMPLE_UNARY_OPERATION_NAMES = setOf(UNARY_PLUS, UNARY_MINUS, NOT) + val SIMPLE_UNARY_OPERATION_NAMES = setOf(UNARY_PLUS, UNARY_MINUS, NOT, INV) @JvmField val BINARY_OPERATION_NAMES = setOf(TIMES, PLUS, MINUS, DIV, MOD, REM, RANGE_TO)