Mark reified assertFailsWith with InlineOnly to preserve stack traces.

This commit is contained in:
Ilya Gorbunov
2016-02-18 20:20:16 +03:00
parent 119eceb80b
commit bf536afe5f
2 changed files with 7 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?,
/** Asserts that a [block] fails with a specific exception of type [T] being thrown.
* Since inline method doesn't allow to trace where it was invoked, it is required to pass a [message] to distinguish this method call from others.
*/
@kotlin.internal.InlineOnly
inline fun <reified T : Throwable> assertFailsWith(message: String? = null, noinline block: () -> Unit): T = assertFailsWith(T::class, message, block)

View File

@@ -8,3 +8,9 @@ package kotlin.internal
@Retention(AnnotationRetention.BINARY)
internal annotation class OnlyInputTypes
/**
* Specifies that this function should not be called directly without inlining
*/
@Target(AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.BINARY)
internal annotation class InlineOnly