Raise deprecation level for jsClass functions

Suppress error in tests

#KT-21703
This commit is contained in:
Ilya Gorbunov
2018-09-06 20:57:14 +03:00
parent 35f42c7d35
commit 62ffacab09
6 changed files with 11 additions and 2 deletions
+1
View File
@@ -1,6 +1,7 @@
// EXPECTED_REACHABLE_NODES: 1169
package foo
@Suppress("DEPRECATION_ERROR")
fun box(): String {
check(jsClass<A>(), A().jsClass)
check(jsClass<B>(), B().jsClass)
@@ -2,6 +2,7 @@
// EXPECTED_REACHABLE_NODES: 1174
package foo
@Suppress("DEPRECATION_ERROR")
fun testWithInstance() {
assertEquals("A", A().jsClass.name)
assertEquals("B", B().jsClass.name)
@@ -13,6 +14,7 @@ fun testWithInstance() {
assertEquals("R", R().jsClass.name)
}
@Suppress("DEPRECATION_ERROR")
fun testWithClassReference() {
assertEquals("A", jsClass<A>().name)
assertEquals("B", jsClass<B>().name)
@@ -1,11 +1,13 @@
// EXPECTED_REACHABLE_NODES: 1165
package foo
@Suppress("DEPRECATION_ERROR")
inline fun <reified T : Any> foo(): JsClass<T> {
val T = 1
return jsClass<T>()
}
@Suppress("DEPRECATION_ERROR")
fun box(): String {
check(jsClass<A>(), foo<A>())
check(jsClass<B>(), foo<B>())
@@ -2,11 +2,13 @@
// EXPECTED_REACHABLE_NODES: 1167
package foo
@Suppress("DEPRECATION_ERROR")
inline fun <reified T : Any> foo(): () -> JsClass<T> {
val T = 1
return { jsClass<T>() }
}
@Suppress("DEPRECATION_ERROR")
fun box(): String {
check(jsClass<A>(), foo<A>()())
check(jsClass<B>(), foo<B>()())
@@ -9,6 +9,7 @@ class Outer {
inner class Inner
}
@Suppress("DEPRECATION_ERROR")
fun testWithInstance() {
assertEquals("A", A().jsClass.simpleName)
assertEquals("B", B().jsClass.simpleName)
@@ -22,6 +23,7 @@ fun testWithInstance() {
assertEquals("Inner", Outer().Inner().jsClass.simpleName)
}
@Suppress("DEPRECATION_ERROR")
fun testWithClassReference() {
assertEquals("A", jsClass<A>().simpleName)
assertEquals("B", jsClass<B>().simpleName)
@@ -19,10 +19,10 @@ external interface JsClass<T : Any> {
val name: String
}
@Deprecated("Use class literal and extension property `js` instead.", replaceWith = ReplaceWith("T::class.js"), level = DeprecationLevel.WARNING)
@Deprecated("Use class literal and extension property `js` instead.", replaceWith = ReplaceWith("T::class.js"), level = DeprecationLevel.ERROR)
external fun <T : Any> jsClass(): JsClass<T>
@Deprecated("Use class literal and extension property `js` instead.", replaceWith = ReplaceWith("this::class.js"), level = DeprecationLevel.WARNING)
@Deprecated("Use class literal and extension property `js` instead.", replaceWith = ReplaceWith("this::class.js"), level = DeprecationLevel.ERROR)
val <T : Any> T.jsClass: JsClass<T>
get() = when (jsTypeOf(this)) {
"string" -> js("String")