From f826011c9ff23135cefc7ba61d6aace6f28e7fc2 Mon Sep 17 00:00:00 2001 From: Nikolay Lunyak Date: Fri, 7 Apr 2023 17:14:22 +0300 Subject: [PATCH] [FIR] KT-57655: Add the missing branch ^KT-57655 Fixed --- ...CompilerTestFE10TestdataTestGenerated.java | 6 ++++++ ...sticCompilerFE10TestDataTestGenerated.java | 6 ++++++ ...eeOldFrontendDiagnosticsTestGenerated.java | 6 ++++++ ...siOldFrontendDiagnosticsTestGenerated.java | 6 ++++++ .../kotlin/fir/resolve/ResolveUtils.kt | 1 + .../implicitIntegerCoercionNamedArg.kt | 21 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 ++++++ 7 files changed, 52 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 0bed2cb6904..a599c0c1131 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -33913,6 +33913,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt"); } + @Test + @TestMetadata("implicitIntegerCoercionNamedArg.kt") + public void testImplicitIntegerCoercionNamedArg() throws Exception { + runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt"); + } + @Test @TestMetadata("inferenceForSignedAndUnsignedTypes.kt") public void testInferenceForSignedAndUnsignedTypes() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index e37a6ddc356..1e08bea7186 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -33913,6 +33913,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt"); } + @Test + @TestMetadata("implicitIntegerCoercionNamedArg.kt") + public void testImplicitIntegerCoercionNamedArg() throws Exception { + runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt"); + } + @Test @TestMetadata("inferenceForSignedAndUnsignedTypes.kt") public void testInferenceForSignedAndUnsignedTypes() 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 a101d9dd7a7..1dc342b10dc 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 @@ -33913,6 +33913,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt"); } + @Test + @TestMetadata("implicitIntegerCoercionNamedArg.kt") + public void testImplicitIntegerCoercionNamedArg() throws Exception { + runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt"); + } + @Test @TestMetadata("inferenceForSignedAndUnsignedTypes.kt") public void testInferenceForSignedAndUnsignedTypes() 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 a01a726fb99..55b580777d3 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 @@ -34009,6 +34009,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt"); } + @Test + @TestMetadata("implicitIntegerCoercionNamedArg.kt") + public void testImplicitIntegerCoercionNamedArg() throws Exception { + runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt"); + } + @Test @TestMetadata("inferenceForSignedAndUnsignedTypes.kt") public void testInferenceForSignedAndUnsignedTypes() 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 9669f2ee72a..6c1ba369756 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 @@ -593,6 +593,7 @@ fun FirExpression?.isIntegerLiteralOrOperatorCall(): Boolean { || kind == ConstantValueKind.UnsignedIntegerLiteral is FirIntegerLiteralOperatorCall -> true + is FirNamedArgumentExpression -> this.expression.isIntegerLiteralOrOperatorCall() else -> false } } diff --git a/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt new file mode 100644 index 00000000000..6b5f20c690f --- /dev/null +++ b/compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt @@ -0,0 +1,21 @@ +// FIR_IDENTICAL +// ISSUE: KT-57655 +// !LANGUAGE: +ImplicitSignedToUnsignedIntegerConversion +// ALLOW_KOTLIN_PACKAGE + +// FILE: annotation.kt + +package kotlin.internal + +annotation class ImplicitIntegerCoercion + +// FILE: test.kt + +import kotlin.internal.ImplicitIntegerCoercion + +fun test(@ImplicitIntegerCoercion x: UInt) = x + +fun main() { + println(test(x = 5)) + println(test(5)) +} 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 e2565b3b182..e9a7fa14b73 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 @@ -34775,6 +34775,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/conversionOfSignedToUnsigned.kt"); } + @Test + @TestMetadata("implicitIntegerCoercionNamedArg.kt") + public void testImplicitIntegerCoercionNamedArg() throws Exception { + runTest("compiler/testData/diagnostics/tests/unsignedTypes/conversions/implicitIntegerCoercionNamedArg.kt"); + } + @Test @TestMetadata("inferenceForSignedAndUnsignedTypes.kt") public void testInferenceForSignedAndUnsignedTypes() throws Exception {