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:
Alexey Andreev
2016-12-19 19:35:16 +03:00
parent 55d4c0e439
commit 6ef4a3389e
28 changed files with 210 additions and 165 deletions
@@ -2,26 +2,26 @@
external class A {
@nativeInvoke
fun foo() {}
fun foo() {noImpl}
@nativeInvoke
fun invoke(a: String): Int = 0
fun invoke(a: String): Int = noImpl
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
val foo = 0
val foo: Int = noImpl
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
object Obj1 {}
companion object {
@nativeInvoke
fun foo() {}
fun foo() { noImpl }
@nativeInvoke
fun invoke(a: String): Int = 0
fun invoke(a: String): Int = noImpl
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
val foo = 0
val foo: Int = noImpl
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
object Obj2 {}
@@ -2,7 +2,7 @@ package
public external final class A {
public constructor A()
@kotlin.js.nativeInvoke public final val foo: kotlin.Int = 0
@kotlin.js.nativeInvoke public final val foo: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.nativeInvoke public final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -11,7 +11,7 @@ public external final class A {
public companion object Companion {
private constructor Companion()
@kotlin.js.nativeInvoke public final val foo: kotlin.Int = 0
@kotlin.js.nativeInvoke public final val foo: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@kotlin.js.nativeInvoke public final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -4,34 +4,26 @@ external class A {
class B {
class C {
@nativeInvoke
fun foo() {}
fun foo() { noImpl }
@nativeInvoke
fun invoke(a: String): Int = 0
fun invoke(a: String): Int = noImpl
}
object obj {
@nativeInvoke
fun foo() {}
fun foo() { noImpl }
@nativeInvoke
fun invoke(a: String): Int = 0
fun invoke(a: String): Int = noImpl
}
companion object {
@nativeInvoke
fun foo() {}
fun foo() { noImpl }
@nativeInvoke
fun invoke(a: String): Int = 0
}
val anonymous = object {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
fun invoke(a: String): Int = noImpl
}
}
}
@@ -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