[FIR] KT-55181: Ensure throw argument is Throwable
`TYPE_MISMATCH` in `throwJLException.fir.kt` appeared, because in `throw Exn` the type of `Exn` is implicit Unit. This is red code anyway. ^KT-55181 Fixed Merge-request: KT-MR-8292 Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
842ad56266
commit
c3b871652f
@@ -156,7 +156,7 @@ fun illegalReturnIf(): Char {
|
||||
}
|
||||
|
||||
fun returnNothing(): Nothing {
|
||||
throw 1
|
||||
throw <!TYPE_MISMATCH!>1<!>
|
||||
}
|
||||
fun f(): Int {
|
||||
if (1 < 2) { return 1 } else returnNothing()
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun main() {
|
||||
throw <!TYPE_MISMATCH!>"str"<!>
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
// FILE: J.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
public class J {
|
||||
@NotNull
|
||||
public static Exception staticNN;
|
||||
@Nullable
|
||||
public static Exception staticN;
|
||||
public static Exception staticJ;
|
||||
}
|
||||
|
||||
// FILE: k.kt
|
||||
|
||||
fun test() {
|
||||
throw J.staticNN
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
throw J.staticN
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
throw J.staticJ
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// FILE: J.java
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// +JDK
|
||||
|
||||
typealias Exn = java.lang.Exception
|
||||
|
||||
fun test() {
|
||||
throw <!NO_COMPANION_OBJECT, TYPE_MISMATCH!>Exn<!>
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// +JDK
|
||||
|
||||
typealias Exn = java.lang.Exception
|
||||
|
||||
Reference in New Issue
Block a user