JS: replace all usages of @native annotation with external modifier, in tests, stdlib, etc

This commit is contained in:
Alexey Andreev
2016-11-25 12:36:47 +03:00
parent e0cb56b3c3
commit 68412ae94f
173 changed files with 486 additions and 651 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
// TARGET_BACKEND: JS // TARGET_BACKEND: JS
package foo package foo
@native interface A { external interface A {
fun foo(value: Int): String fun foo(value: Int): String
} }
@@ -5,14 +5,14 @@ package foo
import kotlin.js.* import kotlin.js.*
@JsModule("A") @JsModule("A")
@native object A { external object A {
fun f(): Int fun f(): Int
val g: Int val g: Int
} }
@JsNonModule @JsNonModule
@native open class B { external open class B {
fun foo(): Int fun foo(): Int
} }
@@ -6,7 +6,7 @@ package bar {
package foo { package foo {
@kotlin.js.JsModule(import = "A") @kotlin.js.native public object A { @kotlin.js.JsModule(import = "A") public external object A {
private constructor A() private constructor A()
public final val g: kotlin.Int public final val g: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -15,7 +15,7 @@ package foo {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.JsNonModule @kotlin.js.native public open class B { @kotlin.js.JsNonModule public external open class B {
public constructor B() public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun foo(): kotlin.Int public final fun foo(): kotlin.Int
@@ -2,6 +2,8 @@
// This should not crash // This should not crash
package foo package foo
@JsModule @native fun foo(x: Int): Int @JsModule
external fun foo(x: Int): Int
@JsModule(23) @native fun bar(x: Int): Int @JsModule(23)
external fun bar(x: Int): Int
@@ -1,6 +1,6 @@
package package
package foo { package foo {
@kotlin.js.JsModule(import = 23) @kotlin.js.native public fun bar(/*0*/ x: kotlin.Int): kotlin.Int @kotlin.js.JsModule(import = 23) public external fun bar(/*0*/ x: kotlin.Int): kotlin.Int
@kotlin.js.JsModule @kotlin.js.native public fun foo(/*0*/ x: kotlin.Int): kotlin.Int @kotlin.js.JsModule public external fun foo(/*0*/ x: kotlin.Int): kotlin.Int
} }
@@ -1,7 +1,7 @@
package foo package foo
<!JS_MODULE_PROHIBITED_ON_VAR!>@JsModule("bar") <!JS_MODULE_PROHIBITED_ON_VAR!>@JsModule("bar")
@native var bar: Int<!> = noImpl external var bar: Int<!> = noImpl
<!JS_MODULE_PROHIBITED_ON_VAR!>@JsNonModule <!JS_MODULE_PROHIBITED_ON_VAR!>@JsNonModule
@native var baz: Int<!> = noImpl external var baz: Int<!> = noImpl
@@ -1,6 +1,6 @@
package package
package foo { package foo {
@kotlin.js.JsModule(import = "bar") @kotlin.js.native public var bar: kotlin.Int @kotlin.js.JsModule(import = "bar") public external var bar: kotlin.Int
@kotlin.js.JsNonModule @kotlin.js.native public var baz: kotlin.Int @kotlin.js.JsNonModule public external var baz: kotlin.Int
} }
@@ -2,16 +2,16 @@
package foo package foo
@JsModule("A") @JsModule("A")
@native class <!NESTED_JS_MODULE_PROHIBITED!>A<!> external class <!NESTED_JS_MODULE_PROHIBITED!>A<!>
@JsModule("B") @JsModule("B")
@native <!NESTED_JS_MODULE_PROHIBITED!>object B<!> external <!NESTED_JS_MODULE_PROHIBITED!>object B<!>
<!NESTED_JS_MODULE_PROHIBITED!>@JsModule("foo") <!NESTED_JS_MODULE_PROHIBITED!>@JsModule("foo")
@native fun foo()<!> = 23 external fun foo()<!> = 23
<!NESTED_JS_MODULE_PROHIBITED!>@JsModule("bar") <!NESTED_JS_MODULE_PROHIBITED!>@JsModule("bar")
@native val bar<!> = 42 external val bar<!> = 42
<!NESTED_JS_MODULE_PROHIBITED!>@JsNonModule <!NESTED_JS_MODULE_PROHIBITED!>@JsNonModule
@native val baz<!> = 99 external val baz<!> = 99
@@ -1,18 +1,18 @@
package package
package foo { package foo {
@kotlin.js.JsModule(import = "bar") @kotlin.js.native public val bar: kotlin.Int = 42 @kotlin.js.JsModule(import = "bar") public external val bar: kotlin.Int = 42
@kotlin.js.JsNonModule @kotlin.js.native public val baz: kotlin.Int = 99 @kotlin.js.JsNonModule public external val baz: kotlin.Int = 99
@kotlin.js.JsModule(import = "foo") @kotlin.js.native public fun foo(): kotlin.Int @kotlin.js.JsModule(import = "foo") public external fun foo(): kotlin.Int
@kotlin.js.JsModule(import = "A") @kotlin.js.native public final class A { @kotlin.js.JsModule(import = "A") public external final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.JsModule(import = "B") @kotlin.js.native public object B { @kotlin.js.JsModule(import = "B") public external object B {
private constructor B() private constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,19 +0,0 @@
package foo
class A {
<!JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL!>@JsModule("foo")
@native fun foo(): Int<!>
}
object B {
<!JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL!>@JsModule("foo")
@native fun bar(): Int<!>
}
fun baz() {
<!JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL!>@JsModule("bzz")
@native fun bzz(): Int<!>
@JsModule("bzz")
@native class <!JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL!>C<!>
}
@@ -1,21 +0,0 @@
package
package foo {
public fun baz(): kotlin.Unit
public final class A {
public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.JsModule(import = "foo") @kotlin.js.native public final fun foo(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public object B {
private constructor B()
@kotlin.js.JsModule(import = "foo") @kotlin.js.native public final fun bar(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -5,19 +5,19 @@ package foo
import kotlin.js.* import kotlin.js.*
@JsModule("A") @JsModule("A")
@native object A { external object A {
fun f(): Int fun f(): Int
val g: Int val g: Int
} }
@JsModule("B") @JsModule("B")
@native open class B { external open class B {
fun foo(): Int fun foo(): Int
} }
@JsModule("bar") @JsModule("bar")
@native fun bar(): Unit external fun bar(): Unit
// MODULE: m2(m1) // MODULE: m2(m1)
// FILE: b.kt // FILE: b.kt
@@ -25,7 +25,7 @@ import kotlin.js.*
@file:JsModule("foo") @file:JsModule("foo")
package foo package foo
@native fun baz(): Unit external fun baz(): Unit
// FILE: c.kt // FILE: c.kt
package bar package bar
@@ -39,4 +39,4 @@ fun box() {
<!CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM!>baz<!>() <!CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM!>baz<!>()
} }
@native class DerivedB : <!CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM!>B<!>() external class DerivedB : <!CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM!>B<!>()
@@ -2,9 +2,9 @@
package package
package foo { package foo {
@kotlin.js.JsModule(import = "bar") @kotlin.js.native public fun bar(): kotlin.Unit @kotlin.js.JsModule(import = "bar") public external fun bar(): kotlin.Unit
@kotlin.js.JsModule(import = "A") @kotlin.js.native public object A { @kotlin.js.JsModule(import = "A") public external object A {
private constructor A() private constructor A()
public final val g: kotlin.Int public final val g: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -13,7 +13,7 @@ package foo {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.JsModule(import = "B") @kotlin.js.native public open class B { @kotlin.js.JsModule(import = "B") public external open class B {
public constructor B() public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun foo(): kotlin.Int public final fun foo(): kotlin.Int
@@ -29,7 +29,7 @@ package
package bar { package bar {
public fun box(): kotlin.Unit public fun box(): kotlin.Unit
@kotlin.js.native public final class DerivedB : foo.B { public external final class DerivedB : foo.B {
public constructor DerivedB() public constructor DerivedB()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun foo(): kotlin.Int public final override /*1*/ /*fake_override*/ fun foo(): kotlin.Int
@@ -39,5 +39,5 @@ package bar {
} }
package foo { package foo {
@kotlin.js.native public fun baz(): kotlin.Unit public external fun baz(): kotlin.Unit
} }
@@ -5,19 +5,19 @@ package foo
import kotlin.js.* import kotlin.js.*
@JsNonModule @JsNonModule
@native object A { external object A {
fun f(): Int fun f(): Int
val g: Int val g: Int
} }
@JsNonModule @JsNonModule
@native open class B { external open class B {
fun foo(): Int fun foo(): Int
} }
@JsNonModule @JsNonModule
@native fun bar(): Unit external fun bar(): Unit
// MODULE: m2(m1) // MODULE: m2(m1)
// MODULE_KIND: AMD // MODULE_KIND: AMD
@@ -33,4 +33,4 @@ fun box() {
<!CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM!>bar<!>() <!CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM!>bar<!>()
} }
@native class DerivedB : <!CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM!>B<!>() external class DerivedB : <!CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM!>B<!>()
@@ -3,7 +3,7 @@ package
package bar { package bar {
public fun box(): kotlin.Unit public fun box(): kotlin.Unit
@kotlin.js.native public final class DerivedB : foo.B { public external final class DerivedB : foo.B {
public constructor DerivedB() public constructor DerivedB()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun foo(): kotlin.Int public final override /*1*/ /*fake_override*/ fun foo(): kotlin.Int
@@ -13,9 +13,9 @@ package bar {
} }
package foo { package foo {
@kotlin.js.JsNonModule @kotlin.js.native public fun bar(): kotlin.Unit @kotlin.js.JsNonModule public external fun bar(): kotlin.Unit
@kotlin.js.JsNonModule @kotlin.js.native public object A { @kotlin.js.JsNonModule public external object A {
private constructor A() private constructor A()
public final val g: kotlin.Int public final val g: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -24,7 +24,7 @@ package foo {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.JsNonModule @kotlin.js.native public open class B { @kotlin.js.JsNonModule public external open class B {
public constructor B() public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final fun foo(): kotlin.Int public final fun foo(): kotlin.Int
@@ -1 +1,4 @@
@native("B") <!JS_NAME_PROHIBITED_FOR_NAMED_NATIVE!>@JsName("C")<!> class A // !DIAGNOSTICS: -DEPRECATION
@native("B")
<!JS_NAME_PROHIBITED_FOR_NAMED_NATIVE!>@JsName("C")<!>
class A
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() { fun foo() {
@nativeGetter @nativeGetter
@@ -1,8 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER
fun foo() { fun foo() {
@native external class A {
class A {
@nativeGetter @nativeGetter
fun get(a: String): Any? = null fun get(a: String): Any? = null
@@ -13,14 +12,12 @@ fun foo() {
fun foo(a: Double): String? = null fun foo(a: Double): String? = null
} }
@native external class B {
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!> <!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0 val foo = 0
} }
@native external class C {
class C {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
fun Int.get(a: String): Int?<!> = 1 fun Int.get(a: String): Int?<!> = 1
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() { fun foo() {
class A { class A {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() { fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
@@ -1,7 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@native external class A {
class A {
@nativeGetter @nativeGetter
fun get(a: String): Any? = null fun get(a: String): Any? = null
@@ -23,8 +22,7 @@ class A {
} }
} }
@native external class B {
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!> <!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0 val foo = 0
@@ -40,8 +38,7 @@ class B {
} }
} }
@native external class C {
class C {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
fun Int.get(a: String): Int?<!> = 1 fun Int.get(a: String): Int?<!> = 1
@@ -1,6 +1,6 @@
package package
@kotlin.js.native public final class A { public final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.nativeGetter public final fun foo(/*0*/ a: kotlin.Double): kotlin.String? @kotlin.js.nativeGetter public final fun foo(/*0*/ a: kotlin.Double): kotlin.String?
@@ -20,7 +20,7 @@ package
} }
} }
@kotlin.js.native public final class B { public final class B {
public constructor B() public constructor B()
@kotlin.js.nativeGetter public final val foo: kotlin.Int = 0 @kotlin.js.nativeGetter public final val foo: kotlin.Int = 0
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -50,7 +50,7 @@ package
} }
} }
@kotlin.js.native public final class C { public final class C {
public constructor C() public constructor C()
@kotlin.js.nativeGetter public final fun bar(/*0*/ a: kotlin.String): kotlin.Int @kotlin.js.nativeGetter public final fun bar(/*0*/ a: kotlin.String): kotlin.Int
@kotlin.js.nativeGetter public final fun baz(/*0*/ a: kotlin.String = ...): kotlin.Int? @kotlin.js.nativeGetter public final fun baz(/*0*/ a: kotlin.String = ...): kotlin.Int?
@@ -1,7 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@native external class A {
class A {
class B { class B {
class A { class A {
@nativeGetter @nativeGetter
@@ -1,6 +1,6 @@
package package
@kotlin.js.native public final class A { public final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A { class A {
class B { class B {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A { class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeGetter @nativeGetter
fun Int.get(a: String): Int? = 1 fun Int.get(a: String): Int? = 1
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
fun toplevelFun(): <!NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE!>Any<!><!> = 0 fun toplevelFun(): <!NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE!>Any<!><!> = 0
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() { fun foo() {
@nativeInvoke @nativeInvoke
@@ -1,8 +1,7 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER
fun foo() { fun foo() {
@native external class A {
class A {
@nativeInvoke @nativeInvoke
fun foo() {} fun foo() {}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() { fun foo() {
class A { class A {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() { fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
@@ -1,7 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@native external class A {
class A {
@nativeInvoke @nativeInvoke
fun foo() {} fun foo() {}
@@ -1,6 +1,6 @@
package package
@kotlin.js.native public final class A { public final class A {
public constructor A() public constructor A()
@kotlin.js.nativeInvoke public final val foo: kotlin.Int = 0 @kotlin.js.nativeInvoke public final val foo: kotlin.Int = 0
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,7 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@native external class A {
class A {
class B { class B {
class C { class C {
@nativeInvoke @nativeInvoke
@@ -1,6 +1,6 @@
package package
@kotlin.js.native public final class A { public final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A { class A {
class B { class B {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A { class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeInvoke @nativeInvoke
fun Int.ext() = 1 fun Int.ext() = 1
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
fun toplevelFun()<!> {} fun toplevelFun()<!> {}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() { fun foo() {
@nativeSetter @nativeSetter
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() { fun foo() {
@native @native
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() { fun foo() {
class A { class A {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() { fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
@@ -1,7 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@native external class A {
class A {
@nativeSetter @nativeSetter
fun set(a: String, v: Any?): Any? = null fun set(a: String, v: Any?): Any? = null
@@ -35,8 +34,7 @@ class A {
} }
} }
@native external class B {
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!> <!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo = 0 val foo = 0
@@ -52,8 +50,7 @@ class B {
} }
} }
@native external class C {
class C {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
fun Int.set(a: String, v: Int)<!> {} fun Int.set(a: String, v: Int)<!> {}
@@ -1,6 +1,6 @@
package package
@kotlin.js.native public final class A { public final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.nativeSetter public final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit @kotlin.js.nativeSetter public final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit
@@ -24,7 +24,7 @@ package
} }
} }
@kotlin.js.native public final class B { public final class B {
public constructor B() public constructor B()
@kotlin.js.nativeSetter public final val foo: kotlin.Int = 0 @kotlin.js.nativeSetter public final val foo: kotlin.Int = 0
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -54,7 +54,7 @@ package
} }
} }
@kotlin.js.native public final class C { public final class C {
public constructor C() public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.nativeSetter public final fun foo(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String = ...): kotlin.String @kotlin.js.nativeSetter public final fun foo(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String = ...): kotlin.String
@@ -1,7 +1,6 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@native external class A {
class A {
class B { class B {
class A { class A {
@nativeSetter @nativeSetter
@@ -1,6 +1,6 @@
package package
@kotlin.js.native public final class A { public final class A {
public constructor A() public constructor A()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION // !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A { class A {
class B { class B {
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A { class A {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeSetter @nativeSetter
fun Int.set(a: String, v: Int) {} fun Int.set(a: String, v: Int) {}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER // !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter <!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
fun toplevelFun(): Any<!> = 0 fun toplevelFun(): Any<!> = 0
@@ -1,7 +1,7 @@
class A { class A {
<!NATIVE_INNER_CLASS_PROHIBITED!>@native inner class B<!> <!NATIVE_INNER_CLASS_PROHIBITED!>external inner class B<!>
} }
@native class C { external class C {
@native inner class D inner external class D
} }
@@ -6,7 +6,7 @@ public final class A {
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@kotlin.js.native public final inner class B { public final inner class B {
public constructor B() public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -14,13 +14,13 @@ public final class A {
} }
} }
@kotlin.js.native public final class C { public final class C {
public constructor C() public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@kotlin.js.native public final inner class D { public final inner class D {
public constructor D() public constructor D()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,26 +1,18 @@
// !DIAGNOSTICS: -UNREACHABLE_CODE // !DIAGNOSTICS: -UNREACHABLE_CODE
// unreachable code suppressed due to KT-9586 // unreachable code suppressed due to KT-9586
@native external val baz: Int
val baz: Int external val boo: Int = noImpl
@native
val boo: Int = noImpl
@native external val Int.baz: Int
val Int.baz: Int
@native external fun foo()
fun foo() external fun bar() {}
@native
fun bar() {}
@native external fun String.foo(): Int
fun String.foo(): Int external fun String.bar(): Int = noImpl
@native
fun String.bar(): Int = noImpl
@native external interface T {
interface T {
val baz: Int val baz: Int
fun foo() fun foo()
@@ -35,8 +27,7 @@ interface T {
} }
} }
@native external class C {
class C {
val baz: Int val baz: Int
val boo: Int = noImpl val boo: Int = noImpl
@@ -52,8 +43,7 @@ class C {
} }
} }
@native external object O {
object O {
val baz: Int val baz: Int
val boo: Int = noImpl val boo: Int = noImpl
@@ -62,8 +52,7 @@ object O {
} }
fun test() { fun test() {
@native external class Local {
class Local {
val baz: Int val baz: Int
val boo: Int = noImpl val boo: Int = noImpl
@@ -1,15 +1,15 @@
package package
@kotlin.js.native public val baz: kotlin.Int public val baz: kotlin.Int
@kotlin.js.native public val boo: kotlin.Int public val boo: kotlin.Int
@kotlin.js.native public val kotlin.Int.baz: kotlin.Int public val kotlin.Int.baz: kotlin.Int
@kotlin.js.native public fun bar(): kotlin.Unit public external fun bar(): kotlin.Unit
@kotlin.js.native public fun foo(): kotlin.Unit public external fun foo(): kotlin.Unit
public fun test(): kotlin.Unit public fun test(): kotlin.Unit
@kotlin.js.native public fun kotlin.String.bar(): kotlin.Int public external fun kotlin.String.bar(): kotlin.Int
@kotlin.js.native public fun kotlin.String.foo(): kotlin.Int public external fun kotlin.String.foo(): kotlin.Int
@kotlin.js.native public final class C { public final class C {
public constructor C() public constructor C()
public final val baz: kotlin.Int public final val baz: kotlin.Int
public final val boo: kotlin.Int public final val boo: kotlin.Int
@@ -31,7 +31,7 @@ public fun test(): kotlin.Unit
} }
} }
@kotlin.js.native public object O { public object O {
private constructor O() private constructor O()
public final val baz: kotlin.Int public final val baz: kotlin.Int
public final val boo: kotlin.Int public final val boo: kotlin.Int
@@ -42,7 +42,7 @@ public fun test(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public interface T { public interface T {
public abstract val baz: kotlin.Int public abstract val baz: kotlin.Int
public open fun bar(): kotlin.Unit public open fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,11 +1,11 @@
// !DIAGNOSTICS: -DEPRECATION
@nativeGetter @nativeGetter
fun String.foo(n: Int): Int? fun String.foo(n: Int): Int?
@nativeGetter @nativeGetter
fun String.bar(n: Int): Int? = noImpl fun String.bar(n: Int): Int? = noImpl
@native external interface T {
interface T {
@nativeGetter @nativeGetter
fun foo(d: Double): String? fun foo(d: Double): String?
@nativeGetter @nativeGetter
@@ -3,7 +3,7 @@ package
@kotlin.js.nativeGetter public fun kotlin.String.bar(/*0*/ n: kotlin.Int): kotlin.Int? @kotlin.js.nativeGetter public fun kotlin.String.bar(/*0*/ n: kotlin.Int): kotlin.Int?
@kotlin.js.nativeGetter public fun kotlin.String.foo(/*0*/ n: kotlin.Int): kotlin.Int? @kotlin.js.nativeGetter public fun kotlin.String.foo(/*0*/ n: kotlin.Int): kotlin.Int?
@kotlin.js.native public interface T { public interface T {
@kotlin.js.nativeGetter public open fun bar(/*0*/ d: kotlin.Double): kotlin.String? @kotlin.js.nativeGetter public open fun bar(/*0*/ d: kotlin.Double): kotlin.String?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.nativeGetter public abstract fun foo(/*0*/ d: kotlin.Double): kotlin.String? @kotlin.js.nativeGetter public abstract fun foo(/*0*/ d: kotlin.Double): kotlin.String?
@@ -1,11 +1,11 @@
// !DIAGNOSTICS: -DEPRECATION
@nativeInvoke @nativeInvoke
fun String.foo(): Int fun String.foo(): Int
@nativeInvoke @nativeInvoke
fun String.bar(): Int = noImpl fun String.bar(): Int = noImpl
@native external object O {
object O {
@nativeInvoke @nativeInvoke
fun foo() fun foo()
@nativeInvoke @nativeInvoke
@@ -3,7 +3,7 @@ package
@kotlin.js.nativeInvoke public fun kotlin.String.bar(): kotlin.Int @kotlin.js.nativeInvoke public fun kotlin.String.bar(): kotlin.Int
@kotlin.js.nativeInvoke public fun kotlin.String.foo(): kotlin.Int @kotlin.js.nativeInvoke public fun kotlin.String.foo(): kotlin.Int
@kotlin.js.native public object O { public object O {
private constructor O() private constructor O()
@kotlin.js.nativeInvoke public final fun bar(): kotlin.Unit @kotlin.js.nativeInvoke public final fun bar(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,11 +1,11 @@
// !DIAGNOSTICS: -DEPRECATION
@nativeSetter @nativeSetter
fun String.foo(n: Int, v: Any) fun String.foo(n: Int, v: Any)
@nativeSetter @nativeSetter
fun String.bar(n: Int, v: Any) {} fun String.bar(n: Int, v: Any) {}
@native external class C {
class C {
@nativeSetter @nativeSetter
fun foo(d: Double, v: Any): Any fun foo(d: Double, v: Any): Any
@nativeSetter @nativeSetter
@@ -3,7 +3,7 @@ package
@kotlin.js.nativeSetter public fun kotlin.String.bar(/*0*/ n: kotlin.Int, /*1*/ v: kotlin.Any): kotlin.Unit @kotlin.js.nativeSetter public fun kotlin.String.bar(/*0*/ n: kotlin.Int, /*1*/ v: kotlin.Any): kotlin.Unit
@kotlin.js.nativeSetter public fun kotlin.String.foo(/*0*/ n: kotlin.Int, /*1*/ v: kotlin.Any): kotlin.Unit @kotlin.js.nativeSetter public fun kotlin.String.foo(/*0*/ n: kotlin.Int, /*1*/ v: kotlin.Any): kotlin.Unit
@kotlin.js.native public final class C { public final class C {
public constructor C() public constructor C()
@kotlin.js.nativeSetter public final fun bar(/*0*/ d: kotlin.Double, /*1*/ v: kotlin.Any): kotlin.Any @kotlin.js.nativeSetter public final fun bar(/*0*/ d: kotlin.Double, /*1*/ v: kotlin.Any): kotlin.Any
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,4 +1,4 @@
@native interface I external interface I
fun box(a: Any, b: Any): Pair<I, I?> { fun box(a: Any, b: Any): Pair<I, I?> {
return Pair(<!UNCHECKED_CAST_TO_NATIVE_INTERFACE!>a as I<!>, <!UNCHECKED_CAST_TO_NATIVE_INTERFACE!>b as? I<!>) return Pair(<!UNCHECKED_CAST_TO_NATIVE_INTERFACE!>a as I<!>, <!UNCHECKED_CAST_TO_NATIVE_INTERFACE!>b as? I<!>)
@@ -2,7 +2,7 @@ package
public fun box(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Any): kotlin.Pair<I, I?> public fun box(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Any): kotlin.Pair<I, I?>
@kotlin.js.native public interface I { public interface I {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -1,4 +1,4 @@
@native interface I external interface I
fun box(a: Any, b: Any): Boolean { fun box(a: Any, b: Any): Boolean {
return <!CANNOT_CHECK_FOR_NATIVE_INTERFACE!>a is I<!> && <!CANNOT_CHECK_FOR_NATIVE_INTERFACE!>b !is I<!> return <!CANNOT_CHECK_FOR_NATIVE_INTERFACE!>a is I<!> && <!CANNOT_CHECK_FOR_NATIVE_INTERFACE!>b !is I<!>
@@ -2,7 +2,7 @@ package
public fun box(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Any): kotlin.Boolean public fun box(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Any): kotlin.Boolean
@kotlin.js.native public interface I { public interface I {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -4,9 +4,9 @@ inline fun <reified T> foo(x: T) {
println(x) println(x)
} }
@native interface I external interface I
@native class C : I external class C : I
operator inline fun <reified T> C.plus(other: T) = this operator inline fun <reified T> C.plus(other: T) = this
@@ -4,14 +4,14 @@ public fun bar(): kotlin.Unit
public inline fun </*0*/ reified T> foo(/*0*/ x: T): kotlin.Unit public inline fun </*0*/ reified T> foo(/*0*/ x: T): kotlin.Unit
public operator inline fun </*0*/ reified T> C.plus(/*0*/ other: T): C public operator inline fun </*0*/ reified T> C.plus(/*0*/ other: T): C
@kotlin.js.native public final class C : I { public final class C : I {
public constructor C() public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public interface I { public interface I {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -1,6 +1,6 @@
@native interface I external interface I
@native interface J external interface J
fun box(a: Any) = when (a) { fun box(a: Any) = when (a) {
<!CANNOT_CHECK_FOR_NATIVE_INTERFACE!>is I<!> -> 0 <!CANNOT_CHECK_FOR_NATIVE_INTERFACE!>is I<!> -> 0
@@ -2,13 +2,13 @@ package
public fun box(/*0*/ a: kotlin.Any): kotlin.Int public fun box(/*0*/ a: kotlin.Any): kotlin.Int
@kotlin.js.native public interface I { public interface I {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public interface J { public interface J {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -1,16 +1,12 @@
@native external fun foo(a: String): Int = noImpl
fun foo(a: String): Int = noImpl
@native external fun Int.foo(a: String): Int = noImpl
fun Int.foo(a: String): Int = noImpl
@native external class Bar(b: Int, c: Char) {
class Bar(b: Int, c: Char) {
fun baz(d: Int) {} fun baz(d: Int) {}
} }
@native external object Obj {
object Obj {
fun test1(e: String) {} fun test1(e: String) {}
object Nested { object Nested {
fun test2(g: Int) {} fun test2(g: Int) {}
@@ -1,9 +1,9 @@
package package
@kotlin.js.native public fun foo(/*0*/ a: kotlin.String): kotlin.Int public external fun foo(/*0*/ a: kotlin.String): kotlin.Int
@kotlin.js.native public fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int public external fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int
@kotlin.js.native public final class Bar { public final class Bar {
public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char) public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char)
public final fun baz(/*0*/ d: kotlin.Int): kotlin.Unit public final fun baz(/*0*/ d: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -11,7 +11,7 @@ package
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public object Obj { public object Obj {
private constructor Obj() private constructor Obj()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,14 +1,13 @@
// !DIAGNOSTICS: -DEPRECATION
@nativeGetter @nativeGetter
fun Int.foo(a: String): Int? = noImpl fun Int.foo(a: String): Int? = noImpl
@native external class Bar(b: Int, c: Char) {
class Bar(b: Int, c: Char) {
@nativeGetter @nativeGetter
fun baz(d: Int): Any? = noImpl fun baz(d: Int): Any? = noImpl
} }
@native external object Obj {
object Obj {
@nativeGetter @nativeGetter
fun test1(e: String): String? = noImpl fun test1(e: String): String? = noImpl
@@ -2,7 +2,7 @@ package
@kotlin.js.nativeGetter public fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int? @kotlin.js.nativeGetter public fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int?
@kotlin.js.native public final class Bar { public final class Bar {
public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char) public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char)
@kotlin.js.nativeGetter public final fun baz(/*0*/ d: kotlin.Int): kotlin.Any? @kotlin.js.nativeGetter public final fun baz(/*0*/ d: kotlin.Int): kotlin.Any?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -10,7 +10,7 @@ package
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public object Obj { public object Obj {
private constructor Obj() private constructor Obj()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,14 +1,13 @@
// !DIAGNOSTICS: -DEPRECATION
@nativeInvoke @nativeInvoke
fun Int.foo(a: String): Int = noImpl fun Int.foo(a: String): Int = noImpl
@native external class Bar(b: Int, c: Char) {
class Bar(b: Int, c: Char) {
@nativeInvoke @nativeInvoke
fun baz(d: Int) {} fun baz(d: Int) {}
} }
@native external object Obj {
object Obj {
@nativeInvoke @nativeInvoke
fun test1(e: String) {} fun test1(e: String) {}
@@ -2,7 +2,7 @@ package
@kotlin.js.nativeInvoke public fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int @kotlin.js.nativeInvoke public fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int
@kotlin.js.native public final class Bar { public final class Bar {
public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char) public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char)
@kotlin.js.nativeInvoke public final fun baz(/*0*/ d: kotlin.Int): kotlin.Unit @kotlin.js.nativeInvoke public final fun baz(/*0*/ d: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -10,7 +10,7 @@ package
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public object Obj { public object Obj {
private constructor Obj() private constructor Obj()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,14 +1,13 @@
// !DIAGNOSTICS: -DEPRECATION
@nativeSetter @nativeSetter
fun Int.foo(a: String, v: Int): Int = noImpl fun Int.foo(a: String, v: Int): Int = noImpl
@native external class Bar(b: Int, c: Char) {
class Bar(b: Int, c: Char) {
@nativeSetter @nativeSetter
fun baz(d: Int, v: Int) {} fun baz(d: Int, v: Int) {}
} }
@native external object Obj {
object Obj {
@nativeSetter @nativeSetter
fun test1(e: String, v: Any) {} fun test1(e: String, v: Any) {}
@@ -2,7 +2,7 @@ package
@kotlin.js.nativeSetter public fun kotlin.Int.foo(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Int): kotlin.Int @kotlin.js.nativeSetter public fun kotlin.Int.foo(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Int): kotlin.Int
@kotlin.js.native public final class Bar { public final class Bar {
public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char) public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char)
@kotlin.js.nativeSetter public final fun baz(/*0*/ d: kotlin.Int, /*1*/ v: kotlin.Int): kotlin.Unit @kotlin.js.nativeSetter public final fun baz(/*0*/ d: kotlin.Int, /*1*/ v: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -10,7 +10,7 @@ package
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
} }
@kotlin.js.native public object Obj { public object Obj {
private constructor Obj() private constructor Obj()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -329,12 +329,6 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
doTest(fileName); doTest(fileName);
} }
@TestMetadata("nonTopLevelProhibited.kt")
public void testNonTopLevelProhibited() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/module/nonTopLevelProhibited.kt");
doTest(fileName);
}
@TestMetadata("prohibitedOnNonNative.kt") @TestMetadata("prohibitedOnNonNative.kt")
public void testProhibitedOnNonNative() throws Exception { public void testProhibitedOnNonNative() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/module/prohibitedOnNonNative.kt"); String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/module/prohibitedOnNonNative.kt");
+2 -4
View File
@@ -1,14 +1,12 @@
package q package q
@native external class Foo {
class Foo {
// RUN: // RUN:
fun foo(s: Array<String>) = noImpl fun foo(s: Array<String>) = noImpl
} }
// RUN: // RUN:
@native external fun main(s: Array<String>) {
fun main(s: Array<String>) {
println("Top-level") println("Top-level")
} }
@@ -222,7 +222,7 @@ class NameSuggestion {
descriptor descriptor
} }
// If declaration is marked with either @native, @library or @JsName, return its stable name as is. // If declaration is marked with either external, @native, @library or @JsName, return its stable name as is.
val nativeName = getNameForAnnotatedObject(overriddenDescriptor) val nativeName = getNameForAnnotatedObject(overriddenDescriptor)
if (nativeName != null) return NameAndStability(nativeName, true) if (nativeName != null) return NameAndStability(nativeName, true)
@@ -50,9 +50,7 @@ private val DIAGNOSTIC_FACTORY_TO_RENDERER by lazy {
put(ErrorsJs.JS_NAME_PROHIBITED_FOR_NAMED_NATIVE, "@JsName is prohibited for @native declaration with explicit name") put(ErrorsJs.JS_NAME_PROHIBITED_FOR_NAMED_NATIVE, "@JsName is prohibited for @native declaration with explicit name")
put(ErrorsJs.JS_MODULE_PROHIBITED_ON_VAR, "@JsModule and @JsNonModule annotations prohibited for 'var' declarations. " + put(ErrorsJs.JS_MODULE_PROHIBITED_ON_VAR, "@JsModule and @JsNonModule annotations prohibited for 'var' declarations. " +
"Use 'val' instead.") "Use 'val' instead.")
put(ErrorsJs.JS_MODULE_PROHIBITED_ON_NON_NATIVE, "@JsModule and @JsNonModule annotations prohibited for non-@native declarations.") put(ErrorsJs.JS_MODULE_PROHIBITED_ON_NON_NATIVE, "@JsModule and @JsNonModule annotations prohibited for non-external declarations.")
put(ErrorsJs.JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL, "@JsModule and @JsNonModule annotations are only allowed to appear " +
"on packages and top-level declarations")
put(ErrorsJs.NESTED_JS_MODULE_PROHIBITED, "@JsModule and @JsNonModule can't appear on here since the file is already " + put(ErrorsJs.NESTED_JS_MODULE_PROHIBITED, "@JsModule and @JsNonModule can't appear on here since the file is already " +
"marked by either @JsModule or @JsNonModule") "marked by either @JsModule or @JsNonModule")
put(ErrorsJs.CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM, "Can't access declaration marked with @JsModule annotation " + put(ErrorsJs.CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM, "Can't access declaration marked with @JsModule annotation " +
@@ -54,7 +54,6 @@ public interface ErrorsJs {
DiagnosticFactory0<PsiElement> JS_NAME_PROHIBITED_FOR_NAMED_NATIVE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0<PsiElement> JS_NAME_PROHIBITED_FOR_NAMED_NATIVE = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtElement> JS_MODULE_PROHIBITED_ON_VAR = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT); DiagnosticFactory0<KtElement> JS_MODULE_PROHIBITED_ON_VAR = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
DiagnosticFactory0<KtElement> JS_MODULE_PROHIBITED_ON_NON_NATIVE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT); DiagnosticFactory0<KtElement> JS_MODULE_PROHIBITED_ON_NON_NATIVE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
DiagnosticFactory0<KtElement> JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
DiagnosticFactory0<KtElement> NESTED_JS_MODULE_PROHIBITED = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT); DiagnosticFactory0<KtElement> NESTED_JS_MODULE_PROHIBITED = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE_OR_DEFAULT);
DiagnosticFactory0<PsiElement> CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM = DiagnosticFactory0.create(ERROR, DEFAULT); DiagnosticFactory0<PsiElement> CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM = DiagnosticFactory0.create(ERROR, DEFAULT);
DiagnosticFactory0<PsiElement> CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM = DiagnosticFactory0.create(ERROR, DEFAULT); DiagnosticFactory0<PsiElement> CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM = DiagnosticFactory0.create(ERROR, DEFAULT);
@@ -42,10 +42,6 @@ object JsModuleChecker : SimpleDeclarationChecker {
diagnosticHolder.report(ErrorsJs.JS_MODULE_PROHIBITED_ON_NON_NATIVE.on(declaration)) diagnosticHolder.report(ErrorsJs.JS_MODULE_PROHIBITED_ON_NON_NATIVE.on(declaration))
} }
if (!DescriptorUtils.isTopLevelDeclaration(descriptor)) {
diagnosticHolder.report(ErrorsJs.JS_MODULE_PROHIBITED_ON_NON_TOPLEVEL.on(declaration))
}
val isFileModuleOrNonModule = AnnotationsUtils.getFileModuleName(bindingContext, descriptor) != null || val isFileModuleOrNonModule = AnnotationsUtils.getFileModuleName(bindingContext, descriptor) != null ||
AnnotationsUtils.isFromNonModuleFile(bindingContext, descriptor) AnnotationsUtils.isFromNonModuleFile(bindingContext, descriptor)
if (isFileModuleOrNonModule) { if (isFileModuleOrNonModule) {
+1 -2
View File
@@ -16,6 +16,5 @@
package kotlin.js.internal package kotlin.js.internal
@native
@JsName("Error") @JsName("Error")
public open class JsError(message: String?) public external open class JsError(message: String?)
+3 -3
View File
@@ -20,8 +20,8 @@ import kotlin.annotation.AnnotationTarget.*
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
@Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER) @Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER)
@native internal annotation class JsName(val name: String) internal external annotation class JsName(val name: String)
@native internal annotation class native internal external annotation class native
@native internal fun js(code: String): dynamic internal external fun js(code: String): dynamic
+10 -17
View File
@@ -18,37 +18,30 @@ package kotlin.js
import kotlin.annotation.AnnotationTarget.* import kotlin.annotation.AnnotationTarget.*
@native
@Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, VALUE_PARAMETER, PROPERTY_GETTER, PROPERTY_SETTER) @Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, VALUE_PARAMETER, PROPERTY_GETTER, PROPERTY_SETTER)
@Deprecated("Use `external` modifier instead") @Deprecated("Use `external` modifier instead")
public annotation class native(@Deprecated public val name: String = "") public external annotation class native(@Deprecated public val name: String = "")
@native
@Target(FUNCTION) @Target(FUNCTION)
@Deprecated @Deprecated("Use inline extension function with body using dynamic")
public annotation class nativeGetter public external annotation class nativeGetter
@native
@Target(FUNCTION) @Target(FUNCTION)
@Deprecated @Deprecated("Use inline extension function with body using dynamic")
public annotation class nativeSetter public external annotation class nativeSetter
@native
@Target(FUNCTION) @Target(FUNCTION)
@Deprecated @Deprecated("Use inline extension function with body using dynamic")
public annotation class nativeInvoke public external annotation class nativeInvoke
@native
@Target(CLASS, FUNCTION, PROPERTY) @Target(CLASS, FUNCTION, PROPERTY)
internal annotation class library(public val name: String = "") internal external annotation class library(public val name: String = "")
@native
@Target(PROPERTY) @Target(PROPERTY)
public annotation class enumerable() public external annotation class enumerable()
@native
@Target(CLASS) @Target(CLASS)
internal annotation class marker internal external annotation class marker
@Retention(AnnotationRetention.BINARY) @Retention(AnnotationRetention.BINARY)
@Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER) @Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER)
+2 -2
View File
@@ -19,9 +19,9 @@ package kotlin.text
// actually \s is enough to match all whitespace, but \xA0 added because of different regexp behavior of Rhino used in Selenium tests // actually \s is enough to match all whitespace, but \xA0 added because of different regexp behavior of Rhino used in Selenium tests
public fun Char.isWhitespace(): Boolean = toString().matches("[\\s\\xA0]") public fun Char.isWhitespace(): Boolean = toString().matches("[\\s\\xA0]")
@native public fun Char.toLowerCase(): Char = noImpl public external fun Char.toLowerCase(): Char = noImpl
@native public fun Char.toUpperCase(): Char = noImpl public external fun Char.toUpperCase(): Char = noImpl
/** /**
* Returns `true` if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit). * Returns `true` if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).
+4 -4
View File
@@ -19,7 +19,7 @@ package kotlin
// Note: // Note:
// Right now we don't want to have neither 'volatile' nor 'synchronized' at runtime, // Right now we don't want to have neither 'volatile' nor 'synchronized' at runtime,
// so they annotated as 'native' to avoid warnings/errors from some minifiers. // so they annotated as `external` to avoid warnings/errors from some minifiers.
// They was reserved word in ECMAScript 2, but is not since ECMAScript 5. // They was reserved word in ECMAScript 2, but is not since ECMAScript 5.
// Additional note: // Additional note:
@@ -29,10 +29,10 @@ package kotlin
@Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD)
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
public annotation class Volatile public external annotation class Volatile
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
public annotation class Synchronized public external annotation class Synchronized
public inline fun <R> synchronized(lock: Any, crossinline block: () -> R): R = block() public external inline fun <R> synchronized(lock: Any, crossinline block: () -> R): R = block()
+6 -11
View File
@@ -1,16 +1,13 @@
package kotlin.js package kotlin.js
@native public external val noImpl: Nothing
public val noImpl: Nothing
get() = throw Exception() get() = throw Exception()
@native public external fun eval(expr: String): dynamic = noImpl
public fun eval(expr: String): dynamic = noImpl
@native public external val undefined: Nothing? = noImpl
public val undefined: Nothing? = noImpl
@native operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = noImpl external operator fun <K, V> MutableMap<K, V>.set(key: K, value: V): V? = noImpl
@library @library
public fun println() {} public fun println() {}
@@ -22,8 +19,7 @@ public fun println(s: Any?) {}
public fun print(s: Any?) {} public fun print(s: Any?) {}
//TODO: consistent parseInt //TODO: consistent parseInt
@native public external fun parseInt(s: String, radix: Int = 10): Int = noImpl
public fun parseInt(s: String, radix: Int = 10): Int = noImpl
@library @library
public fun safeParseInt(s: String): Int? = noImpl public fun safeParseInt(s: String): Int? = noImpl
@@ -31,8 +27,7 @@ public fun safeParseInt(s: String): Int? = noImpl
@library @library
public fun safeParseDouble(s: String): Double? = noImpl public fun safeParseDouble(s: String): Double? = noImpl
@native public external fun js(code: String): dynamic = noImpl
public fun js(code: String): dynamic = noImpl
/** /**
* Function corresponding to JavaScript's `typeof` operator * Function corresponding to JavaScript's `typeof` operator
+1 -2
View File
@@ -1,6 +1,5 @@
package kotlin.js package kotlin.js
@native public external class Date() {
public class Date() {
public fun getTime(): Int = noImpl public fun getTime(): Int = noImpl
} }
+7 -8
View File
@@ -1,13 +1,12 @@
package kotlin.js package kotlin.js
// https://developer.mozilla.org/en/DOM/console // https://developer.mozilla.org/en/DOM/console
@native public interface Console { external public interface Console {
@native public fun dir(o: Any): Unit = noImpl public fun dir(o: Any): Unit = noImpl
@native public fun error(vararg o: Any?): Unit = noImpl public fun error(vararg o: Any?): Unit = noImpl
@native public fun info(vararg o: Any?): Unit = noImpl public fun info(vararg o: Any?): Unit = noImpl
@native public fun log(vararg o: Any?): Unit = noImpl public fun log(vararg o: Any?): Unit = noImpl
@native public fun warn(vararg o: Any?): Unit = noImpl public fun warn(vararg o: Any?): Unit = noImpl
} }
@native public external val console: Console = noImpl
public val console: Console = noImpl
+1 -2
View File
@@ -21,8 +21,7 @@ package java.util
// typealias Date = kotlin.js.Date // typealias Date = kotlin.js.Date
@Deprecated("Use kotlin.js.Date instead", ReplaceWith("kotlin.js.Date")) @Deprecated("Use kotlin.js.Date instead", ReplaceWith("kotlin.js.Date"))
@native public external class Date() {
public class Date() {
public fun getTime(): Int = noImpl public fun getTime(): Int = noImpl
} }
+3 -5
View File
@@ -1,6 +1,6 @@
package kotlin.js package kotlin.js
@native public class Json() { public external class Json() {
operator fun get(propertyName: String): Any? = noImpl operator fun get(propertyName: String): Any? = noImpl
operator fun set(propertyName: String, value: Any?): Unit = noImpl operator fun set(propertyName: String, value: Any?): Unit = noImpl
} }
@@ -16,8 +16,7 @@ public fun json(vararg pairs: Pair<String, Any?>): Json {
@library("jsonAddProperties") @library("jsonAddProperties")
public fun Json.add(other: Json): Json = noImpl public fun Json.add(other: Json): Json = noImpl
@native public external interface JsonClass {
public interface JsonClass {
public fun stringify(o: Any): String public fun stringify(o: Any): String
public fun stringify(o: Any, replacer: (key: String, value: Any?) -> Any?): String public fun stringify(o: Any, replacer: (key: String, value: Any?) -> Any?): String
public fun stringify(o: Any, replacer: (key: String, value: Any?) -> Any?, space: Int): String public fun stringify(o: Any, replacer: (key: String, value: Any?) -> Any?, space: Int): String
@@ -30,5 +29,4 @@ public interface JsonClass {
public fun <T> parse(text: String, reviver: ((key: String, value: Any?) -> Any?)): T public fun <T> parse(text: String, reviver: ((key: String, value: Any?) -> Any?)): T
} }
@native public external val JSON: JsonClass = noImpl
public val JSON: JsonClass = noImpl
+2 -4
View File
@@ -1,8 +1,7 @@
package kotlin.js package kotlin.js
//TODO: declare using number //TODO: declare using number
@native public external class MathClass() {
public class MathClass() {
public val PI: Double = noImpl public val PI: Double = noImpl
public fun random(): Double = noImpl public fun random(): Double = noImpl
public fun abs(value: Double): Double = noImpl public fun abs(value: Double): Double = noImpl
@@ -26,5 +25,4 @@ public class MathClass() {
public fun ceil(value: Number): Int = noImpl public fun ceil(value: Number): Int = noImpl
} }
@native public external val Math: MathClass = MathClass()
public val Math: MathClass = MathClass()
+2 -2
View File
@@ -17,7 +17,7 @@
package kotlin.text.js package kotlin.text.js
@native public class RegExp(pattern: String, flags: String? = null) { public external class RegExp(pattern: String, flags: String? = null) {
public fun test(str: String): Boolean = noImpl public fun test(str: String): Boolean = noImpl
@@ -40,7 +40,7 @@ public fun RegExp.reset() {
} }
// TODO: Inherit from array or introduce asArray() extension // TODO: Inherit from array or introduce asArray() extension
@native public interface RegExpMatch { public external interface RegExpMatch {
public val index: Int public val index: Int
public val input: String public val input: String
public val length: Int public val length: Int
+17 -18
View File
@@ -2,21 +2,21 @@ package kotlin.text
import kotlin.text.js.RegExp import kotlin.text.js.RegExp
@native public fun String.toUpperCase(): String = noImpl public external fun String.toUpperCase(): String = noImpl
@native public fun String.toLowerCase(): String = noImpl public external fun String.toLowerCase(): String = noImpl
@native("indexOf") @JsName("indexOf")
internal fun String.nativeIndexOf(str: String, fromIndex: Int): Int = noImpl internal external fun String.nativeIndexOf(str: String, fromIndex: Int): Int = noImpl
@native("lastIndexOf") @JsName("lastIndexOf")
internal fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = noImpl internal external fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = noImpl
@native("startsWith") @JsName("startsWith")
internal fun String.nativeStartsWith(s: String, position: Int): Boolean = noImpl internal external fun String.nativeStartsWith(s: String, position: Int): Boolean = noImpl
@native("endsWith") @JsName("endsWith")
internal fun String.nativeEndsWith(s: String): Boolean = noImpl internal external fun String.nativeEndsWith(s: String): Boolean = noImpl
@Deprecated("Use split(Regex) instead.", ReplaceWith("split(regex.toRegex()).toTypedArray()")) @Deprecated("Use split(Regex) instead.", ReplaceWith("split(regex.toRegex()).toTypedArray()"))
@library("splitString") @library("splitString")
@@ -26,19 +26,18 @@ public fun String.splitWithRegex(regex: String): Array<String> = noImpl
@library("splitString") @library("splitString")
public fun String.splitWithRegex(regex: String, limit: Int): Array<String> = noImpl public fun String.splitWithRegex(regex: String, limit: Int): Array<String> = noImpl
@native public fun String.substring(startIndex: Int): String = noImpl public external fun String.substring(startIndex: Int): String = noImpl
@native public fun String.substring(startIndex: Int, endIndex: Int): String = noImpl public external fun String.substring(startIndex: Int, endIndex: Int): String = noImpl
@native public fun String.concat(str: String): String = noImpl public external fun String.concat(str: String): String = noImpl
@native public fun String.match(regex: String): Array<String> = noImpl public external fun String.match(regex: String): Array<String> = noImpl
//native public fun String.trim() : String = noImpl //native public fun String.trim() : String = noImpl
//TODO: String.replace to implement effective trimLeading and trimTrailing //TODO: String.replace to implement effective trimLeading and trimTrailing
@native("length") public inline val CharSequence.size: Int get() = asDynamic().length
public val CharSequence.size: Int get() = noImpl
@native("replace") @JsName("replace")
internal fun String.nativeReplace(pattern: RegExp, replacement: String): String = noImpl internal external fun String.nativeReplace(pattern: RegExp, replacement: String): String = noImpl
+15 -18
View File
@@ -2,8 +2,7 @@ package jquery
import org.w3c.dom.Element import org.w3c.dom.Element
@native public external class JQuery() {
public class JQuery() {
public fun addClass(className: String): JQuery = noImpl; public fun addClass(className: String): JQuery = noImpl;
public fun addClass(f: Element.(Int, String) -> String): JQuery = noImpl; public fun addClass(f: Element.(Int, String) -> String): JQuery = noImpl;
@@ -43,8 +42,7 @@ public class JQuery() {
public fun `val`(): String? = noImpl public fun `val`(): String? = noImpl
} }
@native open public external class MouseEvent() {
open public class MouseEvent() {
public val pageX: Double = 0.0; public val pageX: Double = 0.0;
public val pageY: Double = 0.0; public val pageY: Double = 0.0;
public fun preventDefault() { public fun preventDefault() {
@@ -52,20 +50,19 @@ open public class MouseEvent() {
public fun isDefaultPrevented(): Boolean = true; public fun isDefaultPrevented(): Boolean = true;
} }
@native public external class MouseClickEvent() : MouseEvent() {
public class MouseClickEvent() : MouseEvent() {
public val which: Int = 0; public val which: Int = 0;
} }
@native("$") @JsName("$")
public fun jq(selector: String): JQuery = JQuery(); public external fun jq(selector: String): JQuery = JQuery();
@native("$") @JsName("$")
public fun jq(selector: String, context: Element): JQuery = JQuery(); public external fun jq(selector: String, context: Element): JQuery = JQuery();
@native("$") @JsName("$")
public fun jq(callback: () -> Unit): JQuery = JQuery(); public external fun jq(callback: () -> Unit): JQuery = JQuery();
@native("$") @JsName("$")
public fun jq(obj: JQuery): JQuery = JQuery(); public external fun jq(obj: JQuery): JQuery = JQuery();
@native("$") @JsName("$")
public fun jq(el: Element): JQuery = JQuery(); public external fun jq(el: Element): JQuery = JQuery();
@native("$") @JsName("$")
public fun jq(): JQuery = JQuery(); public external fun jq(): JQuery = JQuery();
+19 -20
View File
@@ -4,23 +4,22 @@ package jquery.ui
//jquery UI //jquery UI
import jquery.JQuery import jquery.JQuery
@native public external fun JQuery.buttonset() : JQuery = noImpl;
public fun JQuery.buttonset() : JQuery = noImpl;
@native public external fun JQuery.dialog() : JQuery = noImpl;
public fun JQuery.dialog() : JQuery = noImpl;
@native public external fun JQuery.dialog(params : Json) : JQuery = noImpl
public fun JQuery.dialog(params : Json) : JQuery = noImpl
@native public external fun JQuery.dialog(mode : String, param : String) : Any? = noImpl
public fun JQuery.dialog(mode : String, param : String) : Any? = noImpl
@native public external fun JQuery.dialog(mode : String) : JQuery = noImpl
public fun JQuery.dialog(mode : String) : JQuery = noImpl
@native public external fun JQuery.dialog(mode : String, param : String, value : Any?) : JQuery = noImpl
public fun JQuery.dialog(mode : String, param : String, value : Any?) : JQuery = noImpl
@native public external fun JQuery.button() : JQuery = noImpl;
public fun JQuery.button() : JQuery = noImpl;
@native public external fun JQuery.accordion() : JQuery = noImpl
public fun JQuery.accordion() : JQuery = noImpl
@native public external fun JQuery.draggable(params : Json) : JQuery = noImpl
public fun JQuery.draggable(params : Json) : JQuery = noImpl
@native public external fun JQuery.selectable() : JQuery = noImpl
public fun JQuery.selectable() : JQuery = noImpl
+1 -2
View File
@@ -1,4 +1,3 @@
package org.junit package org.junit
@native public external annotation class Test(val name: String = "")
public annotation class Test(val name: String = "")

Some files were not shown because too many files have changed in this diff Show More