FIR: introduce parameter type is Throwable check

This commit is contained in:
eugenpolytechnic
2021-01-31 17:37:11 +03:00
committed by Mikhail Glukhikh
parent 5c0231b727
commit 9ad88a5a0d
5 changed files with 67 additions and 16 deletions
@@ -1,5 +1,6 @@
FILE: catchParameter.kt
public final fun <T> test(): R|kotlin/Unit| {
public final typealias StringType = R|kotlin/String|
public final fun <T : R|kotlin/Throwable|> test(): R|kotlin/Unit| {
try {
}
catch (e: R|kotlin/NullPointerException| = R|java/lang/NullPointerException.NullPointerException|()) {
@@ -10,6 +11,26 @@ FILE: catchParameter.kt
catch (e: R|T|) {
}
try {
}
catch (e: R|() -> kotlin/Int|) {
}
try {
}
catch (e: R|StringType|) {
}
try {
}
catch (e: R|kotlin/Int| = Int(5)) {
}
try {
}
catch (e: R|kotlin/Throwable|) {
}
}
public final inline fun <reified T> anotherTest(): R|kotlin/Unit| {
try {
@@ -17,4 +38,4 @@ FILE: catchParameter.kt
catch (e: R|T|) {
}
}
}
@@ -1,4 +1,6 @@
fun <T> test() {
typealias StringType = String
fun <T : Throwable> test() {
try {
} catch (<!CATCH_PARAMETER_WITH_DEFAULT_VALUE!>e: NullPointerException = NullPointerException()<!>) {
@@ -6,8 +8,16 @@ fun <T> test() {
}
try {} catch (<!TYPE_PARAMETER_IN_CATCH_CLAUSE!>e: T<!>) {}
try {} catch (<!TYPE_MISMATCH!>e: () -> Int<!>) {}
try {} catch (<!TYPE_MISMATCH!>e: StringType<!>) {}
try {} catch (<!CATCH_PARAMETER_WITH_DEFAULT_VALUE, TYPE_MISMATCH!>e: Int = 5<!>) {}
try {} catch (e: Throwable) {}
}
inline fun <reified T> anotherTest() {
try {} catch (<!REIFIED_TYPE_IN_CATCH_CLAUSE!>e: T<!>) {}
}
try {} catch (<!REIFIED_TYPE_IN_CATCH_CLAUSE, TYPE_MISMATCH!>e: T<!>) {}
}