KT-2752: add draft implementation of JsName annotation. Fix some tests using the annotation

This commit is contained in:
Alexey Andreev
2016-05-30 12:35:41 +03:00
parent 8738458c34
commit 5e3aa33b13
8 changed files with 75 additions and 55 deletions
@@ -56,12 +56,12 @@ val mixed_b = { mixed_boo() + mixed_boo(1) + mixed_boo("str") + mixed_boo("str",
class TestInternal {
fun foo(): Int = 1
fun foo(i: Int): Int = 2
@JsName("foo") internal fun foo(): Int = 1
@JsName("foo_2") internal fun foo(i: Int): Int = 2
fun boo(i: Int): Int = 2
fun boo(s: String): Int = 3
fun boo(): Int = 1
@JsName("boo_2") internal fun boo(i: Int): Int = 2
@JsName("boo_3") internal fun boo(s: String): Int = 3
@JsName("boo") internal fun boo(): Int = 1
}
val internal_in_class_f = { TestInternal().foo() + TestInternal().foo(1) }
@@ -128,25 +128,15 @@ val public_ext_f: A.() -> Int = { -> this.foo() + this.foo }
val public_ext_b: A.() -> Int = { -> this.boo() + this.boo }
interface TestPublicInTrait {
public fun foo(): Int = 2
public val foo: Int
public val boo: Int
public fun boo(): Int = 2
@JsName("foo") fun foo(): Int = 2
@JsName("fooProp") val foo: Int
@JsName("booProp") val boo: Int
@JsName("boo") fun boo(): Int = 2
}
val public_in_trait_f = { obj: TestPublicInTrait -> obj.foo() + obj.foo }
val public_in_trait_b = { obj: TestPublicInTrait -> obj.boo() + obj.boo }
interface TestInternalInTrait {
fun foo(): Int = 2
val foo: Int
val boo: Int
fun boo(): Int = 2
}
val internal_in_trait_f = { obj: TestInternalInTrait -> obj.foo() + obj.foo }
val internal_in_trait_b = { obj: TestInternalInTrait -> obj.boo() + obj.boo }
//Testing
fun test(testName: String, ff: Any, fb: Any) {
@@ -169,7 +159,6 @@ fun box(): String {
test("public_ext_prop", public_ext_f, public_ext_b)
test("public_in_trait", public_in_trait_f, public_in_trait_b)
test("internal_in_trait", internal_in_trait_f, internal_in_trait_b)
return "OK"
}