Perform additional checks on catch parameter declaration
KT-8320 It should not be possible to catch a type parameter type KT-7645 Prohibit default value for `catch`-block parameter
This commit is contained in:
@@ -19,3 +19,7 @@ inline fun <reified E : Exception, R> tryCatch(lazy: () -> R, failure: (E) -> R)
|
||||
} catch (<!REIFIED_TYPE_IN_CATCH_CLAUSE!>e: E<!>) {
|
||||
failure(e)
|
||||
}
|
||||
|
||||
fun <T : Throwable> tryCatch() {
|
||||
try { } catch (<!TYPE_PARAMETER_IN_CATCH_CLAUSE!>e: T<!>) { }
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package
|
||||
|
||||
public fun bar(): kotlin.Unit
|
||||
public fun </*0*/ T : kotlin.Throwable> tryCatch(): kotlin.Unit
|
||||
public inline fun </*0*/ reified E : kotlin.Exception /* = java.lang.Exception */, /*1*/ R> tryCatch(/*0*/ lazy: () -> R, /*1*/ failure: (E) -> R): R
|
||||
|
||||
public final class XException</*0*/ T> : kotlin.Throwable {
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fun test() {
|
||||
try { } catch (<!CATCH_PARAMETER_WITH_DEFAULT_VALUE!>e: Exception = <!DEBUG_INFO_MISSING_UNRESOLVED!>Exception<!>()<!>) { }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
package
|
||||
|
||||
public fun test(): kotlin.Unit
|
||||
Reference in New Issue
Block a user