JS: prohibit native (external) extension properties and functions. See KT-13896
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
class A
|
||||
|
||||
<!WRONG_MODIFIER_TARGET!>external fun A.foo(): Unit = noImpl<!>
|
||||
|
||||
<!WRONG_MODIFIER_TARGET!>external var A.bar: String
|
||||
get() = noImpl
|
||||
set(value) = noImpl<!>
|
||||
|
||||
<!WRONG_MODIFIER_TARGET!>external val A.baz: String
|
||||
get() = noImpl<!>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public external var A.bar: kotlin.String
|
||||
public external val A.baz: kotlin.String
|
||||
public external fun A.foo(): kotlin.Unit
|
||||
|
||||
public final class 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 hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
-20
@@ -39,15 +39,6 @@ external class B {
|
||||
}
|
||||
|
||||
external class C {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get(a: String): Int?<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get2(a: Number): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get3(a: Int): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
|
||||
fun get(): Any?<!> = null
|
||||
|
||||
@@ -63,15 +54,4 @@ external class C {
|
||||
@nativeGetter
|
||||
fun baz(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: String = "foo"<!>): Int? = 0
|
||||
|
||||
companion object {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get(a: String): Int?<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get2(a: Number): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get3(a: Int): String?<!> = "OK"
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
-13
@@ -60,17 +60,4 @@ public external final class C {
|
||||
@kotlin.js.nativeGetter public final fun get(/*0*/ a: A): kotlin.Any?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get(/*0*/ a: kotlin.String): kotlin.Int?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get2(/*0*/ a: kotlin.Number): kotlin.String?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get3(/*0*/ a: kotlin.Int): kotlin.String?
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
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
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get(/*0*/ a: kotlin.String): kotlin.Int?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get2(/*0*/ a: kotlin.Number): kotlin.String?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get3(/*0*/ a: kotlin.Int): kotlin.String?
|
||||
}
|
||||
}
|
||||
|
||||
-27
@@ -41,15 +41,6 @@ external class A {
|
||||
}
|
||||
|
||||
class C {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get(a: String): Int?<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get2(a: Number): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get3(a: Int): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
|
||||
fun get(): Any?<!> = null
|
||||
|
||||
@@ -67,15 +58,6 @@ external class A {
|
||||
}
|
||||
|
||||
object obj {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get(a: String): Int?<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get2(a: Number): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get3(a: Int): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
|
||||
fun get(): Any?<!> = null
|
||||
|
||||
@@ -93,15 +75,6 @@ external class A {
|
||||
}
|
||||
|
||||
val anonymous = object {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get(a: String): Int?<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get2(a: Number): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeGetter
|
||||
fun Int.get3(a: Int): String?<!> = "OK"
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
|
||||
fun get(): Any?<!> = null
|
||||
|
||||
|
||||
-6
@@ -73,9 +73,6 @@ public external final class A {
|
||||
@kotlin.js.nativeGetter public final fun get(/*0*/ a: A.B.A): kotlin.Any?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get(/*0*/ a: kotlin.String): kotlin.Int?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get2(/*0*/ a: kotlin.Number): kotlin.String?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get3(/*0*/ a: kotlin.Int): kotlin.String?
|
||||
}
|
||||
|
||||
public object obj {
|
||||
@@ -88,9 +85,6 @@ public external final class A {
|
||||
@kotlin.js.nativeGetter public final fun get(/*0*/ a: A.B.A): kotlin.Any?
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get(/*0*/ a: kotlin.String): kotlin.Int?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get2(/*0*/ a: kotlin.Number): kotlin.String?
|
||||
@kotlin.js.nativeGetter public final fun kotlin.Int.get3(/*0*/ a: kotlin.Int): kotlin.String?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-12
@@ -7,12 +7,6 @@ external class A {
|
||||
@nativeInvoke
|
||||
fun invoke(a: String): Int = 0
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.ext()<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.invoke(a: String, b: Int)<!> = "OK"
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
||||
val foo = 0
|
||||
|
||||
@@ -26,12 +20,6 @@ external class A {
|
||||
@nativeInvoke
|
||||
fun invoke(a: String): Int = 0
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.ext()<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.invoke(a: String, b: Int)<!> = "OK"
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
|
||||
val foo = 0
|
||||
|
||||
|
||||
Vendored
-4
@@ -8,8 +8,6 @@ public external final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun invoke(/*0*/ a: kotlin.String): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.ext(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.invoke(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
@@ -19,8 +17,6 @@ public external final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun invoke(/*0*/ a: kotlin.String): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.ext(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.invoke(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
|
||||
@kotlin.js.nativeInvoke public object Obj2 {
|
||||
private constructor Obj2()
|
||||
|
||||
-12
@@ -8,12 +8,6 @@ external class A {
|
||||
|
||||
@nativeInvoke
|
||||
fun invoke(a: String): Int = 0
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.ext()<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.invoke(a: String, b: Int)<!> = "OK"
|
||||
}
|
||||
|
||||
object obj {
|
||||
@@ -22,12 +16,6 @@ external class A {
|
||||
|
||||
@nativeInvoke
|
||||
fun invoke(a: String): Int = 0
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.ext()<!> = 1
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
|
||||
fun Int.invoke(a: String, b: Int)<!> = "OK"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
-4
@@ -20,8 +20,6 @@ public external final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun invoke(/*0*/ a: kotlin.String): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.ext(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.invoke(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
}
|
||||
|
||||
public companion object Companion {
|
||||
@@ -40,8 +38,6 @@ public external final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun invoke(/*0*/ a: kotlin.String): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.ext(): kotlin.Int
|
||||
@kotlin.js.nativeInvoke public final fun kotlin.Int.invoke(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
-9
@@ -51,15 +51,6 @@ external class B {
|
||||
}
|
||||
|
||||
external class C {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.set(a: String, v: Int)<!> {}
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set2<!>(a: Number, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set3<!>(a: Double, v: String?)<!> = "OK"
|
||||
|
||||
@nativeSetter
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = 1
|
||||
|
||||
|
||||
Vendored
-3
@@ -65,7 +65,4 @@ public external final class C {
|
||||
@kotlin.js.nativeSetter public final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit
|
||||
@kotlin.js.nativeSetter public final fun set6(/*0*/ a: kotlin.Double, /*1*/ v: kotlin.String): kotlin.Number
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Int): kotlin.Unit
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set2(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String?): kotlin.String
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set3(/*0*/ a: kotlin.Double, /*1*/ v: kotlin.String?): kotlin.String
|
||||
}
|
||||
|
||||
-27
@@ -53,15 +53,6 @@ external class A {
|
||||
}
|
||||
|
||||
class C {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.set(a: String, v: Int)<!> {}
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set2<!>(a: Number, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set3<!>(a: Double, v: String?)<!> = "OK"
|
||||
|
||||
@nativeSetter
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = 1
|
||||
|
||||
@@ -82,15 +73,6 @@ external class A {
|
||||
}
|
||||
|
||||
object obj {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.set(a: String, v: Int)<!> {}
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set2<!>(a: Number, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set3<!>(a: Double, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
|
||||
@@ -108,15 +90,6 @@ external class A {
|
||||
}
|
||||
|
||||
val anonymous = object {
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.set(a: String, v: Int)<!> {}
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set2<!>(a: Number, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
|
||||
fun Int.<!NATIVE_SETTER_WRONG_RETURN_TYPE!>set3<!>(a: Double, v: String?)<!> = "OK"
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
|
||||
|
||||
-6
@@ -78,9 +78,6 @@ public external final class A {
|
||||
@kotlin.js.nativeSetter public final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit
|
||||
@kotlin.js.nativeSetter public final fun set6(/*0*/ a: kotlin.Double, /*1*/ v: kotlin.String): kotlin.Number
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Int): kotlin.Unit
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set2(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String?): kotlin.String
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set3(/*0*/ a: kotlin.Double, /*1*/ v: kotlin.String?): kotlin.String
|
||||
}
|
||||
|
||||
public object obj {
|
||||
@@ -93,9 +90,6 @@ public external final class A {
|
||||
@kotlin.js.nativeSetter public final fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit
|
||||
@kotlin.js.nativeSetter public final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Int): kotlin.Unit
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set2(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String?): kotlin.String
|
||||
@kotlin.js.nativeSetter public final fun kotlin.Int.set3(/*0*/ a: kotlin.Double, /*1*/ v: kotlin.String?): kotlin.String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ class TopLevel {
|
||||
<!NESTED_EXTERNAL_DECLARATION!>external val y: String<!>
|
||||
|
||||
val O.u: String get() = "O.u"
|
||||
|
||||
<!NESTED_EXTERNAL_DECLARATION!>external val O.v: String<!> get() = noImpl
|
||||
}
|
||||
|
||||
external class TopLevelNative {
|
||||
@@ -33,10 +31,6 @@ external class TopLevelNative {
|
||||
val x = "a"
|
||||
|
||||
<!NESTED_EXTERNAL_DECLARATION!>external val y: String<!>
|
||||
|
||||
val O.u: String get() = "O.u"
|
||||
|
||||
<!NESTED_EXTERNAL_DECLARATION!>external val O.v: String<!> get() = noImpl
|
||||
}
|
||||
|
||||
fun topLevelFun() {
|
||||
|
||||
@@ -14,7 +14,6 @@ public final class TopLevel {
|
||||
public final val x: kotlin.String = "a"
|
||||
public external final val y: kotlin.String
|
||||
public final val O.u: kotlin.String
|
||||
public external final val O.v: kotlin.String
|
||||
public final external fun bar(): kotlin.Int
|
||||
@kotlin.js.native public final fun baz(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
@@ -41,8 +40,6 @@ public external final class TopLevelNative {
|
||||
public constructor TopLevelNative()
|
||||
public final val x: kotlin.String = "a"
|
||||
public external final val y: kotlin.String
|
||||
public final val O.u: kotlin.String
|
||||
public external final val O.v: kotlin.String
|
||||
public final external fun bar(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(): kotlin.Int
|
||||
|
||||
@@ -4,14 +4,9 @@
|
||||
external val baz: Int
|
||||
external val boo: Int = noImpl
|
||||
|
||||
external val Int.baz: Int
|
||||
|
||||
external fun foo()
|
||||
external fun bar() {}
|
||||
|
||||
external fun String.foo(): Int
|
||||
external fun String.bar(): Int = noImpl
|
||||
|
||||
external interface T {
|
||||
val baz: Int
|
||||
|
||||
|
||||
@@ -2,11 +2,8 @@ package
|
||||
|
||||
public external val baz: kotlin.Int
|
||||
public external val boo: kotlin.Int
|
||||
public external val kotlin.Int.baz: kotlin.Int
|
||||
public external fun bar(): kotlin.Unit
|
||||
public external fun foo(): kotlin.Unit
|
||||
public external fun kotlin.String.bar(): kotlin.Int
|
||||
public external fun kotlin.String.foo(): kotlin.Int
|
||||
|
||||
public external final class C {
|
||||
public constructor C()
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
external fun foo(a: String): Int = noImpl
|
||||
|
||||
external fun Int.foo(a: String): Int = noImpl
|
||||
|
||||
external class Bar(b: Int, c: Char) {
|
||||
fun baz(d: Int) {}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package
|
||||
|
||||
public external fun foo(/*0*/ a: kotlin.String): kotlin.Int
|
||||
public external fun kotlin.Int.foo(/*0*/ a: kotlin.String): kotlin.Int
|
||||
|
||||
public external final class Bar {
|
||||
public constructor Bar(/*0*/ b: kotlin.Int, /*1*/ c: kotlin.Char)
|
||||
|
||||
@@ -527,6 +527,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunctionAndProperty.kt")
|
||||
public void testExtensionFunctionAndProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/extensionFunctionAndProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nested.kt")
|
||||
public void testNested() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nested.kt");
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
package org.jetbrains.kotlin.js.resolve.diagnostics
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyAccessorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.diagnostics.DiagnosticSink
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.js.PredefinedAnnotation
|
||||
@@ -28,6 +30,7 @@ import org.jetbrains.kotlin.psi.KtProperty
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.checkers.SimpleDeclarationChecker
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
|
||||
|
||||
class JsExternalChecker : SimpleDeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, diagnosticHolder: DiagnosticSink,
|
||||
@@ -46,6 +49,15 @@ class JsExternalChecker : SimpleDeclarationChecker {
|
||||
else if (descriptor is PropertyAccessorDescriptor && isDirectlyExternal(declaration, descriptor)) {
|
||||
diagnosticHolder.report(Errors.WRONG_MODIFIER_TARGET.on(declaration, KtTokens.EXTERNAL_KEYWORD, "property accessor"))
|
||||
}
|
||||
|
||||
if (descriptor !is PropertyAccessorDescriptor && descriptor.isExtension) {
|
||||
val target = when (descriptor) {
|
||||
is FunctionDescriptor -> "extension function"
|
||||
is PropertyDescriptor -> "extension property"
|
||||
else -> "extension member"
|
||||
}
|
||||
diagnosticHolder.report(Errors.WRONG_MODIFIER_TARGET.on(declaration, KtTokens.EXTERNAL_KEYWORD, target))
|
||||
}
|
||||
}
|
||||
|
||||
private fun isDirectlyExternal(declaration: KtDeclaration, descriptor: DeclarationDescriptor): Boolean {
|
||||
|
||||
@@ -5639,12 +5639,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt1519.kt")
|
||||
public void testKt1519() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/native/kt1519.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt2209.kt")
|
||||
public void testKt2209() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/native/kt2209.kt");
|
||||
@@ -5669,12 +5663,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativeExtensionLikeMember.kt")
|
||||
public void testNativeExtensionLikeMember() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/native/nativeExtensionLikeMember.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativeGetterAndNativeSetter.kt")
|
||||
public void testNativeGetterAndNativeSetter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/native/nativeGetterAndNativeSetter.kt");
|
||||
@@ -5687,12 +5675,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativePropertyWithCustomName.kt")
|
||||
public void testNativePropertyWithCustomName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/native/nativePropertyWithCustomName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedElements.kt")
|
||||
public void testNestedElements() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/native/nestedElements.kt");
|
||||
@@ -6314,12 +6296,6 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativePropertiesNameClashes.kt")
|
||||
public void testNativePropertiesNameClashes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/nativePropertiesNameClashes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadedOverriddenFunctionPropertyName.kt")
|
||||
public void testOverloadedOverriddenFunctionPropertyName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt");
|
||||
|
||||
+3
-17
@@ -1,19 +1,5 @@
|
||||
package foo
|
||||
|
||||
// HACKS
|
||||
|
||||
external const val PATH_TO_F_CREATOR = "B\$far\$lambda"
|
||||
external const val PATH_TO_G_CREATOR = "B\$gar\$lambda"
|
||||
|
||||
@JsName("$PATH_TO_F_CREATOR")
|
||||
external val F_CREATOR: Any = noImpl
|
||||
|
||||
@JsName("$PATH_TO_G_CREATOR")
|
||||
external val G_CREATOR: Any = noImpl
|
||||
|
||||
|
||||
// Test
|
||||
|
||||
open class A {
|
||||
fun foo() = "A::foo"
|
||||
}
|
||||
@@ -34,8 +20,8 @@ fun box(): String {
|
||||
assertEquals("A::foo", f())
|
||||
assertEquals("B::boo", g())
|
||||
|
||||
val fs = F_CREATOR.toString()
|
||||
val gs = G_CREATOR.toString().replaceAll("boo", "foo").replaceAll("gar", "far")
|
||||
val fs = js("B\$far\$lambda").toString() as String
|
||||
val gs = (js("B\$gar\$lambda").toString() as String).replaceAll("boo", "foo").replaceAll("gar", "far")
|
||||
|
||||
assertEquals(gs, fs)
|
||||
|
||||
@@ -45,7 +31,7 @@ fun box(): String {
|
||||
|
||||
// Helpers
|
||||
|
||||
external fun String.replace(regexp: RegExp, replacement: String): String = noImpl
|
||||
inline fun String.replace(regexp: RegExp, replacement: String): String = asDynamic().replace(regexp, replacement)
|
||||
|
||||
fun String.replaceAll(regexp: String, replacement: String): String = replace(RegExp(regexp, "g"), replacement)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package foo
|
||||
|
||||
external fun String.replace(regexp: RegExp, replacement: String): String = noImpl
|
||||
inline fun String.replace(regexp: RegExp, replacement: String): String = asDynamic().replace(regexp, replacement)
|
||||
|
||||
fun String.replaceAll(regexp: String, replacement: String): String = replace(RegExp(regexp, "g"), replacement)
|
||||
|
||||
external fun String.search(regexp: RegExp): Int = noImpl
|
||||
inline fun String.search(regexp: RegExp): Int = asDynamic().search(regexp)
|
||||
|
||||
external class RegExp(regexp: String, flags: String = "") {
|
||||
fun exec(s: String): Array<String>? = noImpl
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package foo
|
||||
|
||||
external fun String.charCodeAt(i: Int): Int = noImpl
|
||||
inline fun String.charCodeAt(i: Int): Int = asDynamic().charCodeAt(i)
|
||||
|
||||
// Because String in JS doesn't have hashCode method
|
||||
fun String.myHashCode(): Int {
|
||||
|
||||
@@ -28,9 +28,9 @@ package foo
|
||||
|
||||
// CHECK_NOT_CALLED: moveTo
|
||||
|
||||
external fun Array<Int>.push(element: Int): Unit = noImpl
|
||||
inline fun Array<Int>.push(element: Int): Unit = asDynamic().push(element)
|
||||
|
||||
external fun Array<Int>.splice(index: Int, howMany: Int): Unit = noImpl
|
||||
inline fun Array<Int>.splice(index: Int, howMany: Int): Unit = asDynamic().splice(index, howMany)
|
||||
|
||||
data class PairArray<T, R>(val fst: Array<T>, val snd: Array<R>)
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
function Wow() {
|
||||
this.x = 1;
|
||||
this.y = 2;
|
||||
}
|
||||
|
||||
Wow.prototype.sum = function () {
|
||||
return this.x + this.y;
|
||||
};
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package foo
|
||||
|
||||
external class Wow() {
|
||||
val x: Int = noImpl
|
||||
val y: Int = noImpl
|
||||
}
|
||||
|
||||
external fun Wow.sum(): Int = noImpl
|
||||
|
||||
fun Wow.dblSum(): Int {
|
||||
return 2 * sum()
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
return if (Wow().dblSum() == 6) "OK" else "fail"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
function A(value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
A.prototype.bar = function() { return "A.bar " + this.value; };
|
||||
@@ -1,39 +0,0 @@
|
||||
package foo
|
||||
|
||||
external open class A(val value: String) {
|
||||
}
|
||||
|
||||
class B : A("B") {
|
||||
fun bar(): String = "B.bar ${value}"
|
||||
var prop: String = "B prop"
|
||||
}
|
||||
|
||||
external fun A.bar(): String = noImpl
|
||||
|
||||
external var A.prop: String
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
|
||||
fun box(): String {
|
||||
var a: A = A("A")
|
||||
val b: B = B()
|
||||
|
||||
assertEquals("A.bar A", a.bar())
|
||||
assertEquals("B.bar B", b.bar())
|
||||
|
||||
assertEquals("A.bar A", (A::bar)(a))
|
||||
assertEquals("B.bar B", (A::bar)(b))
|
||||
|
||||
a.prop = "prop"
|
||||
assertEquals("prop", a.prop)
|
||||
assertEquals("prop", (A::prop).get(a))
|
||||
|
||||
a = b
|
||||
assertEquals("B.bar B", a.bar())
|
||||
assertEquals("B.bar B", (A::bar)(a))
|
||||
|
||||
assertEquals("B prop", a.prop)
|
||||
assertEquals("B prop", (A::prop).get(a))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
var boo = "K";
|
||||
@@ -1,32 +0,0 @@
|
||||
package foo
|
||||
|
||||
// TODO: this feature is deprecated, remove this test when either @native annotation or its parameter get eliminated.
|
||||
|
||||
internal @native("\"O\"") val foo: String = noImpl
|
||||
internal @native("boo") val bar: String = noImpl
|
||||
|
||||
internal class A
|
||||
internal @native("__proto__") val Any.proto: String get() = noImpl
|
||||
internal @native("__proto__") val A.proto: String get() = noImpl
|
||||
|
||||
internal fun actual(foo: String, @native("boo") bar: String) = foo + bar
|
||||
internal fun expected(foo: String, boo: String) = foo + boo
|
||||
|
||||
fun box(): String {
|
||||
val OK = "OK"
|
||||
|
||||
if (foo + bar != OK) return "$foo + $bar != $OK"
|
||||
|
||||
val actualAsString = js("actual").toString()
|
||||
val expectedAsString = js("expected").toString().replace("expected", "actual")
|
||||
if (actualAsString != expectedAsString) return "$actualAsString != $expectedAsString"
|
||||
if (actual("asd", "12345") != "asd12345") return "${actual("asd", "12345")} != \"asd12345\""
|
||||
|
||||
val a = A()
|
||||
val any: Any = a
|
||||
val protoA = A::class.js.asDynamic().prototype
|
||||
if (a.proto != any.proto || a.proto != protoA)
|
||||
return "a.proto != any.proto /*${a.proto != any.proto}*/ || a.proto != A.prototype /*${a.proto != protoA}*/"
|
||||
|
||||
return OK
|
||||
}
|
||||
@@ -4,11 +4,6 @@ external class A(val v: String) {
|
||||
fun m(i:Int, s:String): String = noImpl
|
||||
}
|
||||
|
||||
external fun A.nativeExt(i:Int, s:String): String = noImpl
|
||||
|
||||
@JsName("nativeExt2AnotherName")
|
||||
external fun A.nativeExt2(i:Int, s:String): String = noImpl
|
||||
|
||||
fun bar(a: A, extLambda: A.(Int, String) -> String): String = a.(extLambda)(4, "boo")
|
||||
|
||||
fun box(): String {
|
||||
@@ -17,11 +12,5 @@ fun box(): String {
|
||||
assertEquals("A.m test 4 boo", a.m(4, "boo"))
|
||||
assertEquals("A.m test 4 boo", bar(a, fun A.(i, s) = (A::m)(this, i, s)))
|
||||
|
||||
assertEquals("nativeExt test 4 boo", a.nativeExt(4, "boo"))
|
||||
assertEquals("nativeExt test 4 boo", bar(a, fun A.(i, s) = (A::nativeExt)(this, i, s)))
|
||||
|
||||
assertEquals("nativeExt2 test 4 boo", a.nativeExt2(4, "boo"))
|
||||
assertEquals("nativeExt2 test 4 boo", bar(a, fun A.(i, s) = (A::nativeExt2)(this, i, s)))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ fun anotherCount(vararg a: Int) = anotherParamCount(*a)
|
||||
|
||||
external fun test3(bar: Bar, dummy: Int, vararg args: Int): Boolean = noImpl
|
||||
|
||||
external fun Bar.test2(order: Int, dummy: Int, vararg args: Int): Boolean = noImpl
|
||||
|
||||
external class Bar(val size: Int, order: Int = 0) {
|
||||
fun test(order: Int, dummy: Int, vararg args: Int): Boolean = noImpl
|
||||
companion object {
|
||||
@@ -34,8 +32,6 @@ fun spreadInMethodCall(size: Int, vararg args: Int) = Bar(size).test(0, 1, *args
|
||||
|
||||
fun spreadInObjectMethodCall(size: Int, vararg args: Int) = obj.test(size, *args)
|
||||
|
||||
fun spreadInMethodCallWithReceiver(size: Int, vararg args: Int) = Bar(size).test2(0, 1, *args)
|
||||
|
||||
fun spreadInPackageMethodCall(size: Int, vararg args: Int) = test3(Bar(size), 1, *args)
|
||||
|
||||
external fun testNativeVarargWithFunLit(vararg args: Int, f: (a: IntArray) -> Boolean): Boolean = noImpl
|
||||
@@ -98,9 +94,6 @@ fun box(): String {
|
||||
if (!(spreadInObjectMethodCall(2, 1, 2)))
|
||||
return "failed when call method of object using spread operator"
|
||||
|
||||
if (!spreadInMethodCallWithReceiver(2, 1, 2))
|
||||
return "failed when call method using spread operator with receiver"
|
||||
|
||||
if (!spreadInPackageMethodCall(2, 1, 2))
|
||||
return "failed when call package method using spread operator"
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package foo
|
||||
|
||||
val PACKAGE = "kotlin.modules.JS_TESTS.foo"
|
||||
|
||||
class A
|
||||
external val Any.__proto__: String get() = noImpl
|
||||
external val A.__proto__: String get() = noImpl
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
val any: Any = a
|
||||
val protoA = eval("$PACKAGE.A.prototype")
|
||||
if (a.__proto__ != any.__proto__ || a.__proto__ != protoA)
|
||||
return "a.__proto__ != any.__proto__ /*${a.__proto__ != any.__proto__}*/ || a.__proto__ != $PACKAGE.A.prototype /*${a.__proto__ != protoA}*/"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user