FIR checker: reproduce KT-42350
This commit is contained in:
committed by
Dmitriy Novozhilov
parent
da69e3db7c
commit
ea2f773e54
+10
@@ -3844,6 +3844,16 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignedInTryWithCatch.kt")
|
||||
public void testAssignedInTryWithCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignedInTryWithoutCatch.kt")
|
||||
public void testAssignedInTryWithoutCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithoutCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignmentInLocalsInConstructor.kt")
|
||||
public void testAssignmentInLocalsInConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt");
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
fun assignedInTry() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignmentInTry(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun assignedInTryAndCatch() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
a = 41
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignedInTryAndCatch(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
s as String // Potential cast exception
|
||||
a = 41
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun assignedAtAll() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
a = 41
|
||||
} finally {
|
||||
a = 40
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignedInTryCatchButNotFinally(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
s as String // Potential cast exception
|
||||
a = 41
|
||||
} finally {
|
||||
a = 40
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
fun assignedInTry() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignmentInTry(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun assignedInTryAndCatch() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
<!VAL_REASSIGNMENT!>a<!> = 41
|
||||
} finally {
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignedInTryAndCatch(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} catch (e: Exception) {
|
||||
s as String // Potential cast exception
|
||||
<!VAL_REASSIGNMENT!>a<!> = 41
|
||||
} finally {
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun assignedAtAll() {
|
||||
val a: Int
|
||||
try {
|
||||
<!UNUSED_VALUE!>a =<!> 42
|
||||
} catch (e: Exception) {
|
||||
<!UNUSED_VALUE!><!VAL_REASSIGNMENT!>a<!> =<!> 41
|
||||
} finally {
|
||||
a = 40
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignedInTryCatchButNotFinally(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
<!UNUSED_VALUE!>a =<!> 42
|
||||
} catch (e: Exception) {
|
||||
s as String // Potential cast exception
|
||||
<!UNUSED_VALUE!><!VAL_REASSIGNMENT!>a<!> =<!> 41
|
||||
} finally {
|
||||
a = 40
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
public fun assignedAtAll(): kotlin.Unit
|
||||
public fun assignedInTry(): kotlin.Unit
|
||||
public fun assignedInTryAndCatch(): kotlin.Unit
|
||||
public fun sideEffectBeforeAssignedInTryAndCatch(/*0*/ s: kotlin.Any): kotlin.Unit
|
||||
public fun sideEffectBeforeAssignedInTryCatchButNotFinally(/*0*/ s: kotlin.Any): kotlin.Unit
|
||||
public fun sideEffectBeforeAssignmentInTry(/*0*/ s: kotlin.Any): kotlin.Unit
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
fun assignedInTry() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignmentInTry(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} finally {
|
||||
}
|
||||
<!UNINITIALIZED_VARIABLE!>a<!>.hashCode()
|
||||
}
|
||||
|
||||
fun assignedInTryAndFinally() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} finally {
|
||||
a = 41
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignmentInTryButNotFinally(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} finally {
|
||||
a = 41
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
fun assignedInTry() {
|
||||
val a: Int
|
||||
try {
|
||||
a = 42
|
||||
} finally {
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignmentInTry(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
a = 42
|
||||
} finally {
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun assignedInTryAndFinally() {
|
||||
val a: Int
|
||||
try {
|
||||
<!UNUSED_VALUE!>a =<!> 42
|
||||
} finally {
|
||||
<!VAL_REASSIGNMENT!>a<!> = 41
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
|
||||
fun sideEffectBeforeAssignmentInTryButNotFinally(s: Any) {
|
||||
val a: Int
|
||||
try {
|
||||
s as String // Potential cast exception
|
||||
<!UNUSED_VALUE!>a =<!> 42
|
||||
} finally {
|
||||
<!VAL_REASSIGNMENT!>a<!> = 41
|
||||
}
|
||||
a.hashCode()
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun assignedInTry(): kotlin.Unit
|
||||
public fun assignedInTryAndFinally(): kotlin.Unit
|
||||
public fun sideEffectBeforeAssignmentInTry(/*0*/ s: kotlin.Any): kotlin.Unit
|
||||
public fun sideEffectBeforeAssignmentInTryButNotFinally(/*0*/ s: kotlin.Any): kotlin.Unit
|
||||
@@ -3851,6 +3851,16 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTestWithFirVali
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignedInTryWithCatch.kt")
|
||||
public void testAssignedInTryWithCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignedInTryWithoutCatch.kt")
|
||||
public void testAssignedInTryWithoutCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithoutCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignmentInLocalsInConstructor.kt")
|
||||
public void testAssignmentInLocalsInConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt");
|
||||
|
||||
Generated
+10
@@ -3846,6 +3846,16 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInIfElse.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignedInTryWithCatch.kt")
|
||||
public void testAssignedInTryWithCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignedInTryWithoutCatch.kt")
|
||||
public void testAssignedInTryWithoutCatch() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithoutCatch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("assignmentInLocalsInConstructor.kt")
|
||||
public void testAssignmentInLocalsInConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt");
|
||||
|
||||
Reference in New Issue
Block a user