diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java index 6e30525b945..3fa491c5409 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirOldFrontendDiagnosticsTestGenerated.java @@ -3839,6 +3839,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInFinally.kt"); } + @TestMetadata("assignedInIfElse.kt") + public void testAssignedInIfElse() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt"); + } + @TestMetadata("assignmentInLocalsInConstructor.kt") public void testAssignmentInLocalsInConstructor() throws Exception { runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt"); diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.fir.kt new file mode 100644 index 00000000000..d372c1e84f2 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.fir.kt @@ -0,0 +1,16 @@ +fun foo(arg: Boolean) { + val x : Int + if (arg) { + x = 4 + } else { + x = 2 + } + + x.hashCode() + + class Local { + fun bar() { + x.hashCode() + } + } +} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt new file mode 100644 index 00000000000..7a2840c0aa3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt @@ -0,0 +1,16 @@ +fun foo(arg: Boolean) { + val x : Int + if (arg) { + x = 4 + } else { + x = 2 + } + + x.hashCode() + + class Local { + fun bar() { + x.hashCode() + } + } +} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.txt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.txt new file mode 100644 index 00000000000..a1c8cea4e97 --- /dev/null +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.txt @@ -0,0 +1,3 @@ +package + +public fun foo(/*0*/ arg: kotlin.Boolean): kotlin.Unit diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java index be7d38c0a43..a26191251d0 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestGenerated.java @@ -3846,6 +3846,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInFinally.kt"); } + @TestMetadata("assignedInIfElse.kt") + public void testAssignedInIfElse() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt"); + } + @TestMetadata("assignmentInLocalsInConstructor.kt") public void testAssignmentInLocalsInConstructor() throws Exception { runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java index e504725bcc5..25aa047b7d7 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsUsingJavacTestGenerated.java @@ -3841,6 +3841,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInFinally.kt"); } + @TestMetadata("assignedInIfElse.kt") + public void testAssignedInIfElse() throws Exception { + runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt"); + } + @TestMetadata("assignmentInLocalsInConstructor.kt") public void testAssignmentInLocalsInConstructor() throws Exception { runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt");