From 06e83e895f5a309136495af1caee983cdec8db5b Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Mon, 19 Dec 2016 19:38:49 +0300 Subject: [PATCH] JS: update backend tests to respect new front-end rules for `external` declarations --- .../testData/box/crossModuleRef/constructor.kt | 2 +- .../testData/box/expression/function/_common.kt | 2 +- .../testData/box/expression/function/mangling.kt | 3 +++ .../testData/box/inheritance/fromNativeInterface.kt | 8 +++++--- js/js.translator/testData/box/inlineMultiFile/_common.kt | 2 +- js/js.translator/testData/box/native/nestedElements.kt | 6 +++--- .../box/native/overrideNativeOverloadedFunction.kt | 4 ++-- js/js.translator/testData/box/native/vararg.kt | 4 ++-- 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/js/js.translator/testData/box/crossModuleRef/constructor.kt b/js/js.translator/testData/box/crossModuleRef/constructor.kt index f9b66ef01ca..47595b09ed8 100644 --- a/js/js.translator/testData/box/crossModuleRef/constructor.kt +++ b/js/js.translator/testData/box/crossModuleRef/constructor.kt @@ -7,7 +7,7 @@ class A(val x: Int) { } external class B(x: Int) { - constructor(a: Int, b: Int) : this(0) {} + constructor(a: Int, b: Int) : this(0) { noImpl } val x: Int } diff --git a/js/js.translator/testData/box/expression/function/_common.kt b/js/js.translator/testData/box/expression/function/_common.kt index 171e96fbd4b..99a185729d1 100644 --- a/js/js.translator/testData/box/expression/function/_common.kt +++ b/js/js.translator/testData/box/expression/function/_common.kt @@ -6,6 +6,6 @@ fun String.replaceAll(regexp: String, replacement: String): String = replace(Reg inline fun String.search(regexp: RegExp): Int = asDynamic().search(regexp) -external class RegExp(regexp: String, flags: String = "") { +external class RegExp(regexp: String, flags: String = noImpl) { fun exec(s: String): Array? = noImpl } \ No newline at end of file diff --git a/js/js.translator/testData/box/expression/function/mangling.kt b/js/js.translator/testData/box/expression/function/mangling.kt index 82401d1f4dc..06e8e5da85f 100644 --- a/js/js.translator/testData/box/expression/function/mangling.kt +++ b/js/js.translator/testData/box/expression/function/mangling.kt @@ -6,11 +6,13 @@ public fun public_baz(i: Int) { log = "public_baz" } external public fun public_baz(a: String) { + noImpl } internal fun internal_baz(i: Int) { } internal external fun internal_baz(a: String) { + noImpl } private fun getCurrentPackage(): dynamic = js("_").foo @@ -18,6 +20,7 @@ private fun getCurrentPackage(): dynamic = js("_").foo private fun private_baz(i: Int) { } private external fun private_baz(a: String) { + noImpl } public class PublicClass { diff --git a/js/js.translator/testData/box/inheritance/fromNativeInterface.kt b/js/js.translator/testData/box/inheritance/fromNativeInterface.kt index bdb90cd135c..99fbc14a2b1 100644 --- a/js/js.translator/testData/box/inheritance/fromNativeInterface.kt +++ b/js/js.translator/testData/box/inheritance/fromNativeInterface.kt @@ -1,11 +1,13 @@ package foo external interface A { - val bar: Int get() = noImpl - fun foo(): String = noImpl + val bar: Int? get() = noImpl + fun foo(): String } -class C : A +class C : A { + override fun foo() = "foo" +} fun box(): String { val c = C() diff --git a/js/js.translator/testData/box/inlineMultiFile/_common.kt b/js/js.translator/testData/box/inlineMultiFile/_common.kt index 33160377bad..8f79b277794 100644 --- a/js/js.translator/testData/box/inlineMultiFile/_common.kt +++ b/js/js.translator/testData/box/inlineMultiFile/_common.kt @@ -1 +1 @@ -external public fun parseInt(s: String, radix: Int = 10): Int = noImpl \ No newline at end of file +external public fun parseInt(s: String, radix: Int = noImpl): Int = noImpl \ No newline at end of file diff --git a/js/js.translator/testData/box/native/nestedElements.kt b/js/js.translator/testData/box/native/nestedElements.kt index 4be1187936d..06608303baf 100644 --- a/js/js.translator/testData/box/native/nestedElements.kt +++ b/js/js.translator/testData/box/native/nestedElements.kt @@ -113,7 +113,7 @@ external object Object { interface Trait { val a: String var b: String - fun test(): Int = noImpl + fun test(): Int companion object { val a: String = noImpl @@ -149,7 +149,7 @@ external class Class { interface Trait { val a: String var b: String - fun test(): Int = noImpl + fun test(): Int companion object { val a: String = noImpl @@ -189,7 +189,7 @@ external interface Trait { interface Trait { val a: String var b: String - fun test(): Int = noImpl + fun test(): Int companion object { val a: String = noImpl diff --git a/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt b/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt index 8996efe1f34..926148c9bad 100644 --- a/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt +++ b/js/js.translator/testData/box/native/overrideNativeOverloadedFunction.kt @@ -1,7 +1,7 @@ external open class A { - open fun f(x: Int) = "number" + open fun f(x: Int): String = noImpl - open fun f(x: String) = "string" + open fun f(x: String): String = noImpl } class B : A() { diff --git a/js/js.translator/testData/box/native/vararg.kt b/js/js.translator/testData/box/native/vararg.kt index 7de8e081d36..62cabdf4daf 100644 --- a/js/js.translator/testData/box/native/vararg.kt +++ b/js/js.translator/testData/box/native/vararg.kt @@ -16,11 +16,11 @@ fun anotherCount(vararg a: Int) = anotherParamCount(*a) external fun test3(bar: Bar, dummy: Int, vararg args: Int): Boolean = noImpl -external class Bar(val size: Int, order: Int = 0) { +external class Bar(val size: Int, order: Int = noImpl) { fun test(order: Int, dummy: Int, vararg args: Int): Boolean = noImpl companion object { fun startNewTest(): Boolean = noImpl - var hasOrderProblem: Boolean = false + var hasOrderProblem: Boolean = noImpl } }