KT-1041 Add check that thrown/catched expression is of Throwable type
This commit is contained in:
@@ -157,7 +157,7 @@ fun illegalReturnIf(): Char {
|
||||
}
|
||||
|
||||
fun returnNothing(): Nothing {
|
||||
throw 1
|
||||
throw <error>1</error>
|
||||
}
|
||||
fun f(): Int {
|
||||
if (1 < 2) { return 1 } else returnNothing()
|
||||
|
||||
@@ -107,7 +107,7 @@ fun t7() : Int {
|
||||
return 1
|
||||
<error>2</error>
|
||||
}
|
||||
catch (e : Any) {
|
||||
catch (<error>e : Any</error>) {
|
||||
<warning>2</warning>
|
||||
}
|
||||
return 1 // this is OK, like in Java
|
||||
@@ -118,7 +118,7 @@ fun t8() : Int {
|
||||
return 1
|
||||
<error>2</error>
|
||||
}
|
||||
catch (e : Any) {
|
||||
catch (<error>e : Any</error>) {
|
||||
return 1
|
||||
<error>2</error>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user