Introduce apiVersionIsAtLeast function to branch in inlines

#KT-16028
This commit is contained in:
Ilya Gorbunov
2017-09-07 17:50:15 +03:00
parent 485ca10b84
commit 3ab7946c4d
3 changed files with 20 additions and 0 deletions
@@ -62,3 +62,15 @@ private fun getJavaVersion(): Int {
default
}
}
/**
* Constant check of api version used during compilation
*
* This function is evaluated at compile time to a constant value,
* so there should be no references to it in other modules.
*
* The function usages are validated to have literal argument values.
*/
@PublishedApi
internal fun apiVersionIsAtLeast(major: Int, minor: Int, patch: Int) =
KotlinVersion.CURRENT.isAtLeast(major, minor, patch)