Kotlin: Add test for generated throw statements

This commit is contained in:
Ian Lynagh
2024-05-22 14:09:15 +01:00
parent f458ca9568
commit 839258897a
6 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
sealed interface Foo {}
interface Bar: Foo {}
interface Baz: Foo {}
private fun someFun(v: Foo) {
// This doesn't generate a throw statement in Kotlin 1 mode
when (v) {
is Bar -> {}
is Baz -> {}
}
}

View File

@@ -0,0 +1,4 @@
import java
from ThrowStmt ts
select ts

View File

@@ -0,0 +1,12 @@
sealed interface Foo {}
interface Bar: Foo {}
interface Baz: Foo {}
private fun someFun(v: Foo) {
when (v) {
is Bar -> {}
is Baz -> {}
}
}

View File

@@ -0,0 +1 @@
| generated-throws.kt:7:5:10:5 | throw ... |

View File

@@ -0,0 +1,4 @@
import java
from ThrowStmt ts
select ts