Implement Unwrap/Remove for try expressions
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
// OPTION: 1
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
<caret>catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// OPTION: 1
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
<caret>catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// OPTION: 1
|
||||
fun foo(n: Int): Int {
|
||||
try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
val m = -1
|
||||
m
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
<caret>finally {
|
||||
println("finally")
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// OPTION: 1
|
||||
fun foo(n: Int): Int {
|
||||
try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
val m = -1
|
||||
m
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}<caret>
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
<caret>finally {
|
||||
println("finally")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}<caret>
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
try {
|
||||
n / 0
|
||||
}
|
||||
<caret>catch (e: ArithmeticException) {
|
||||
val m = -1
|
||||
m
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
val m = -1
|
||||
m<caret>
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
<caret>catch (e: ArithmeticException) {
|
||||
val m = -1
|
||||
m
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
<caret>catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
finally {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
return -1<caret>
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
<caret>finally {
|
||||
val s = "finally"
|
||||
println(s)
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// OPTION: 0
|
||||
fun foo(n: Int): Int {
|
||||
val s = "finally"
|
||||
println(s)<caret>
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
<caret>finally {
|
||||
val s = "finally"
|
||||
println(s)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo(n: Int): Int {
|
||||
return try {
|
||||
n / 0
|
||||
}
|
||||
catch (e: ArithmeticException) {
|
||||
-1
|
||||
}
|
||||
catch (e: Exception) {
|
||||
-2
|
||||
}
|
||||
<caret>finally {
|
||||
println("finally")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// OPTION: 1
|
||||
fun foo(n : Int): Int {
|
||||
<caret>try {
|
||||
val m = n + 1
|
||||
m/0
|
||||
} catch (e: Exception) {
|
||||
-1
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// OPTION: 1
|
||||
fun foo(n : Int): Int {
|
||||
val m = n + 1
|
||||
m/0
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo(n : Int): Int {
|
||||
return <caret>try {
|
||||
val m = n + 1
|
||||
m/0
|
||||
} catch (e: Exception) {
|
||||
-1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// OPTION: 0
|
||||
fun foo(n : Int): Int {
|
||||
return try {
|
||||
n/0<caret>
|
||||
} catch (e: Exception) {
|
||||
-1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// OPTION: 0
|
||||
fun foo(n : Int): Int {
|
||||
return n/0
|
||||
}
|
||||
Reference in New Issue
Block a user