JS: prohibit external functions and accessors with bodies other than noImpl. Prohibit to use anything except noImpl for default parameters initializers in external functions. See KT-13892
This commit is contained in:
Vendored
+18
-18
@@ -2,48 +2,48 @@
|
||||
|
||||
external class A {
|
||||
@nativeSetter
|
||||
fun set(a: String, v: Any?): Any? = null
|
||||
fun set(a: String, v: Any?): Any? = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun put(a: Number, v: String) {}
|
||||
fun put(a: Number, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(a: Int, v: String) {}
|
||||
fun foo(a: Int, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set4(a: Double, v: String): Any = 1
|
||||
fun set4(a: Double, v: String): Any = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun set5(a: Double, v: String): CharSequence = "OK"
|
||||
fun set5(a: Double, v: String): CharSequence = noImpl
|
||||
|
||||
companion object {
|
||||
@nativeSetter
|
||||
fun set(a: String, v: Any?): Any? = null
|
||||
fun set(a: String, v: Any?): Any? = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun put(a: Number, v: String) {}
|
||||
fun put(a: Number, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(a: Int, v: String) {}
|
||||
fun foo(a: Int, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set4(a: Double, v: String): Any = 1
|
||||
fun set4(a: Double, v: String): Any = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun set5(a: Double, v: String): CharSequence = "OK"
|
||||
fun set5(a: Double, v: String): CharSequence = noImpl
|
||||
}
|
||||
}
|
||||
|
||||
external class B {
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
val foo = 0
|
||||
val foo: Int = noImpl
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
object Obj1 {}
|
||||
|
||||
companion object {
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
val foo = 0
|
||||
val foo: Int = noImpl
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
object Obj2 {}
|
||||
@@ -52,20 +52,20 @@ external class B {
|
||||
|
||||
external class C {
|
||||
@nativeSetter
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = 1
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
fun set(): Any?<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = null
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(a: String, v: Any, v2: Any)<!> {}
|
||||
fun set(a: String, v: Any, v2: Any)<!> { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) {}
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(a: Number, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = "aa"<!>) = "OK"
|
||||
fun foo(a: Number, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = noImpl<!>): String = noImpl
|
||||
}
|
||||
Vendored
+2
-2
@@ -26,14 +26,14 @@ public external final class A {
|
||||
|
||||
public external final class B {
|
||||
public constructor B()
|
||||
@kotlin.js.nativeSetter public final val foo: kotlin.Int = 0
|
||||
@kotlin.js.nativeSetter public final val foo: 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
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
@kotlin.js.nativeSetter public final val foo: kotlin.Int = 0
|
||||
@kotlin.js.nativeSetter public final val foo: 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
|
||||
|
||||
+23
-40
@@ -4,48 +4,48 @@ external class A {
|
||||
class B {
|
||||
class A {
|
||||
@nativeSetter
|
||||
fun set(a: String, v: Any?): Any? = null
|
||||
fun set(a: String, v: Any?): Any? = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun put(a: Number, v: String) {}
|
||||
fun put(a: Number, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(a: Int, v: String) {}
|
||||
fun foo(a: Int, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set4(a: Double, v: String): Any = 1
|
||||
fun set4(a: Double, v: String): Any = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun set5(a: Double, v: String): CharSequence = "OK"
|
||||
fun set5(a: Double, v: String): CharSequence = noImpl
|
||||
|
||||
companion object {
|
||||
@nativeSetter
|
||||
fun set(a: String, v: Any?): Any? = null
|
||||
fun set(a: String, v: Any?): Any? = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun put(a: Number, v: String) {}
|
||||
fun put(a: Number, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(a: Int, v: String) {}
|
||||
fun foo(a: Int, v: String) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set4(a: Double, v: String): Any = 1
|
||||
fun set4(a: Double, v: String): Any = noImpl
|
||||
|
||||
@nativeSetter
|
||||
fun set5(a: Double, v: String): CharSequence = "OK"
|
||||
fun set5(a: Double, v: String): CharSequence = noImpl
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
val foo = 0
|
||||
val foo: Int = noImpl
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
object Obj1 {}
|
||||
|
||||
companion object {
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
val foo = 0
|
||||
val foo: Int = noImpl
|
||||
|
||||
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
|
||||
object Obj2 {}
|
||||
@@ -54,56 +54,39 @@ external class A {
|
||||
|
||||
class C {
|
||||
@nativeSetter
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = 1
|
||||
fun set6(a: Double, v: String): <!NATIVE_SETTER_WRONG_RETURN_TYPE!>Number<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
fun set(): Any?<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = null
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(a: String, v: Any, v2: Any)<!> {}
|
||||
fun set(a: String, v: Any, v2: Any)<!> { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) {}
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Double = 0.0<!>, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = "str"<!>) = "OK"
|
||||
fun foo(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Double = noImpl<!>, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = noImpl<!>): String = noImpl
|
||||
}
|
||||
|
||||
object obj {
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
fun set(): Any?<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = null
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = noImpl
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(a: String, v: Any, v2: Any)<!> {}
|
||||
fun set(a: String, v: Any, v2: Any)<!> { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) {}
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) { noImpl }
|
||||
|
||||
@nativeSetter
|
||||
fun foo(a: Int, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = "str"<!>) = "OK"
|
||||
}
|
||||
|
||||
val anonymous = object {
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(): Any?<!> = null
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>): Any?<!> = null
|
||||
|
||||
<!NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter
|
||||
fun set(a: String, v: Any, v2: Any)<!> {}
|
||||
|
||||
@nativeSetter
|
||||
fun set(<!NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER!>a: A<!>, v: Any?) {}
|
||||
|
||||
@nativeSetter
|
||||
fun foo(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Number = 0.0<!>, v: String) = "OK"
|
||||
fun foo(a: Int, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = noImpl<!>): String = noImpl
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -8,7 +8,6 @@ public external final class A {
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
public final val anonymous: kotlin.Any
|
||||
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
|
||||
@@ -39,14 +38,14 @@ public external final class A {
|
||||
|
||||
public final class B {
|
||||
public constructor B()
|
||||
@kotlin.js.nativeSetter public final val foo: kotlin.Int = 0
|
||||
@kotlin.js.nativeSetter public final val foo: 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
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
@kotlin.js.nativeSetter public final val foo: kotlin.Int = 0
|
||||
@kotlin.js.nativeSetter public final val foo: 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
|
||||
|
||||
Reference in New Issue
Block a user