JS: add restrictions to external modifier according to KT-13893

This commit is contained in:
Alexey Andreev
2016-11-25 17:52:40 +03:00
parent c0c6992ea6
commit d0ffb5bd32
26 changed files with 298 additions and 290 deletions
@@ -1,60 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() {
@native
class A {
@nativeSetter
fun set(a: String, v: Any?): Any? = null
@nativeSetter
fun put(a: Number, v: String) {}
@nativeSetter
fun foo(a: Int, v: String) {}
@nativeSetter
fun set4(a: Double, v: String): Any = 1
@nativeSetter
fun set5(a: Double, v: String): CharSequence = "OK"
}
@native
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo = 0
}
@native
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
<!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"
@nativeSetter
fun boo(a: Number, <!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>v: String = "str"<!>) = "OK"
}
}
@@ -1,3 +0,0 @@
package
public fun foo(): kotlin.Unit