[FIR JS] Implement FirJsNativeAnnotationChecker

This commit is contained in:
Nikolay Lunyak
2023-01-04 16:47:50 +02:00
committed by Space Team
parent a20e29e8b7
commit 5b3a73f7cd
56 changed files with 330 additions and 1044 deletions
@@ -1,24 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() {
@nativeGetter
fun Int.get(a: String): Int? = 1
@nativeGetter
fun Int.get2(a: Number): String? = "OK"
@nativeGetter
fun Int.get3(a: Int): String? = "OK"
@nativeGetter
fun Int.get(a: Any): Int? = 1
@nativeGetter
fun Int.get2(): String? = "OK"
@nativeGetter
fun Int.get3(a: Any, b: Int, c: Any?): String? = "OK"
@nativeGetter
fun Any.foo(a: Int = 1): Any? = "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() {
@@ -1,45 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
class A {
@nativeGetter
fun get(a: String): Any? = null
@nativeGetter
fun take(a: Number): String? = null
@nativeGetter
fun foo(a: Double): String? = null
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0
}
class C {
@nativeGetter
fun Int.get(a: String): Int? = 1
@nativeGetter
fun Int.get2(a: Number): String? = "OK"
@nativeGetter
fun Int.get3(a: Int): String? = "OK"
@nativeGetter
fun get(): Any? = null
@nativeGetter
fun get(a: A): Any? = null
@nativeGetter
fun foo(a: Int) {}
@nativeGetter
fun bar(a: String): Int = 0
@nativeGetter
fun baz(a: Int = 0): Int? = 0
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@@ -1,12 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@nativeGetter
fun toplevelFun(): Any = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val toplevelVal = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
class Foo {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@@ -9,4 +10,4 @@ fun foo() {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
class Foo {}
}
}
@@ -1,57 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
@nativeGetter
fun get(a: String): Any? = definedExternally
@nativeGetter
fun take(a: Number): String? = definedExternally
@nativeGetter
fun foo(a: Double): String? = definedExternally
companion object {
@nativeGetter
fun get(a: String): Any? = definedExternally
@nativeGetter
fun take(a: Number): String? = definedExternally
@nativeGetter
fun foo(a: Double): String? = definedExternally
}
}
external class B {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj2 {}
}
}
external class C {
@nativeGetter
fun get(): Any? = definedExternally
@nativeGetter
fun get(a: A): Any? = definedExternally
@nativeGetter
fun foo(a: Int) { definedExternally }
@nativeGetter
fun bar(a: String): Int = definedExternally
@nativeGetter
fun baz(a: String = definedExternally): Int? = definedExternally
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
@@ -1,77 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
class B {
class A {
@nativeGetter
fun get(a: String): Any? = definedExternally
@nativeGetter
fun take(a: Number): String? = definedExternally
@nativeGetter
fun foo(a: Double): String? = definedExternally
companion object {
@nativeGetter
fun get(a: String): Any? = definedExternally
@nativeGetter
fun take(a: Number): String? = definedExternally
@nativeGetter
fun foo(a: Double): String? = definedExternally
}
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj2 {}
}
}
class C {
@nativeGetter
fun get(): Any? = definedExternally
@nativeGetter
fun get(a: A): Any? = definedExternally
@nativeGetter
fun foo(a: Int) { definedExternally }
@nativeGetter
fun bar(a: String): Int = definedExternally
@nativeGetter
fun baz(a: Number = definedExternally): Int? = definedExternally
}
object obj {
@nativeGetter
fun get(): Any? = definedExternally
@nativeGetter
fun get(a: A): Any? = definedExternally
@nativeGetter
fun foo(a: Int) { definedExternally }
@nativeGetter
fun bar(a: String): Int = definedExternally
@nativeGetter
fun baz(a: String = definedExternally): Int? = definedExternally
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
@@ -1,112 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A {
class B {
class A {
@nativeGetter
fun get(a: String): Any? = null
@nativeGetter
fun take(a: Number): String? = null
@nativeGetter
fun foo(a: Double): String? = null
companion object {
@nativeGetter
fun get(a: String): Any? = null
@nativeGetter
fun take(a: Number): String? = null
@nativeGetter
fun foo(a: Double): String? = null
}
}
class B {
@nativeGetter
fun Int.get(a: String): Int? = 1
@nativeGetter
fun Int.get2(a: Number): String? = "OK"
@nativeGetter
fun Int.get3(a: Int): String? = "OK"
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj2 {}
@nativeGetter
fun Int.get(a: String): Int? = 1
@nativeGetter
fun Int.get2(a: Number): String? = "OK"
@nativeGetter
fun Int.get3(a: Int): String? = "OK"
}
}
class C {
@nativeGetter
fun get(): Any? = null
@nativeGetter
fun get(a: A): Any? = null
@nativeGetter
fun foo(a: Int) {}
@nativeGetter
fun bar(a: String): Int = 0
@nativeGetter
fun baz(a: String = "foo"): Int? = 0
}
object obj {
@nativeGetter
fun get(): Any? = null
@nativeGetter
fun get(a: A): Any? = null
@nativeGetter
fun foo(a: Int) {}
@nativeGetter
fun bar(a: String): Int = 0
@nativeGetter
fun baz(a: Double = 0.0): Int? = 0
}
val anonymous = object {
@nativeGetter
fun get(): Any? = null
@nativeGetter
fun get(a: A): Any? = null
@nativeGetter
fun foo(a: Int) {}
@nativeGetter
fun bar(a: String): Int = 0
@nativeGetter
fun baz(a: String = "foo"): Int? = 0
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A {
@@ -1,65 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A {
@nativeGetter
fun get(a: String): Any? = null
@nativeGetter
fun take(a: Number): String? = null
@nativeGetter
fun foo(a: Double): String? = null
companion object {
@nativeGetter
fun get(a: String): Any? = null
@nativeGetter
fun take(a: Number): String? = null
@nativeGetter
fun foo(a: Double): String? = null
}
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
object Obj2 {}
}
}
class C {
@nativeGetter
fun Int.get(a: String): Int? = 1
@nativeGetter
fun Int.get2(a: Number): String? = "OK"
@nativeGetter
fun Int.get3(a: Int): String? = "OK"
@nativeGetter
fun get(): Any? = null
@nativeGetter
fun get(a: A): Any? = null
@nativeGetter
fun foo(a: Int) {}
@nativeGetter
fun bar(a: String): Int = 0
@nativeGetter
fun baz(a: String = "foo"): Int? = 0
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A {
@@ -1,22 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeGetter
fun Int.get(a: String): Int? = 1
@nativeGetter
fun Int.get2(a: Number): String? = "OK"
@nativeGetter
fun Int.get3(a: Int): String? = "OK"
@nativeGetter
fun Int.baz(a: Int = 0): String? = "OK"
@nativeGetter
fun Int.get(a: Any): Int? = 1
@nativeGetter
fun Int.get2(): String? = "OK"
@nativeGetter
fun Int.get3(a: Any, b: Int, c: Any?): String? = "OK"
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeGetter
@@ -1,10 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeGetter
fun toplevelFun(): Any = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
val toplevelVal = 0
<!WRONG_ANNOTATION_TARGET!>@nativeGetter<!>
class Foo {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeGetter
@@ -1,25 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
class A {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
@nativeInvoke
fun Int.ext() = 1
@nativeInvoke
fun Int.invoke(a: String, b: Int) = "OK"
val anonymous = object {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@@ -22,4 +23,4 @@ fun foo() {
fun invoke(a: String): Int<!> = 0
}
}
}
}
@@ -1,12 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@nativeInvoke
fun toplevelFun() {}
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
val toplevelVal = 0
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
class Foo {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@@ -9,4 +10,4 @@ fun foo() {
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
class Foo {}
}
}
@@ -1,43 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A {
class B {
class C {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
@nativeInvoke
fun Int.ext() = 1
@nativeInvoke
fun Int.invoke(a: String, b: Int) = "OK"
}
object obj {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
}
companion object {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
}
val anonymous = object {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A {
@@ -40,4 +41,4 @@ class A {
fun invoke(a: String): Int<!> = 0
}
}
}
}
@@ -1,35 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
@nativeInvoke
fun Int.ext() = 1
@nativeInvoke
fun Int.invoke(a: String, b: Int) = "OK"
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
val baz = 0
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
object Obj {}
companion object {
@nativeInvoke
fun foo() {}
@nativeInvoke
fun invoke(a: String): Int = 0
@nativeInvoke
fun Int.ext() = 1
@nativeInvoke
fun Int.invoke(a: String, b: Int) = "OK"
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A {
@@ -1,10 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeInvoke
fun toplevelFun() {}
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
val toplevelVal = 0
<!WRONG_ANNOTATION_TARGET!>@nativeInvoke<!>
class Foo {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeInvoke
@@ -1,33 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() {
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?): Any? = null
@nativeSetter
fun Int.set3(a: Double, v: String) = "OK"
@nativeSetter
fun Int.set4(a: Double, v: String): Any = 1
@nativeSetter
fun Int.set5(a: Double, v: String): CharSequence = "OK"
@nativeSetter
fun Int.set6(a: Double, v: String): Number = 1
@nativeSetter
fun Int.set(a: Any): Int? = 1
@nativeSetter
fun Int.set2(): String? = "OK"
@nativeSetter
fun Int.set3(a: Any, b: Int, c: Any?) {}
@nativeSetter
fun Any.foo(a: Double = 0.0, v: String? = null) = "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
fun foo() {
@@ -1,45 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
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) {}
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
var foo = 0
}
class C {
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?) = "OK"
@nativeSetter
fun Int.set3(a: Double, v: String?) = "OK"
@nativeSetter
fun set(): Any? = null
@nativeSetter
fun set(a: A): Any? = null
@nativeSetter
fun set(a: String, v: Any, v2: Any) {}
@nativeSetter
fun set(a: A, v: Any?) {}
@nativeSetter
fun foo(a: Int = 0, v: String) = "OK"
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@@ -42,4 +43,4 @@ fun foo() {
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN!>@nativeSetter
fun foo(<!NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS!>a: Int = 0<!>, v: String)<!> = "OK"
}
}
}
@@ -1,12 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@nativeSetter
fun toplevelFun(): Any = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val toplevelVal = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
class Foo {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
fun foo() {
@@ -9,4 +10,4 @@ fun foo() {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
class Foo {}
}
}
@@ -1,71 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
@nativeSetter
fun set(a: String, v: Any?): Any? = definedExternally
@nativeSetter
fun put(a: Number, v: String) { definedExternally }
@nativeSetter
fun foo(a: Int, v: String) { definedExternally }
@nativeSetter
fun set4(a: Double, v: String): Any = definedExternally
@nativeSetter
fun set5(a: Double, v: String): CharSequence = definedExternally
companion object {
@nativeSetter
fun set(a: String, v: Any?): Any? = definedExternally
@nativeSetter
fun put(a: Number, v: String) { definedExternally }
@nativeSetter
fun foo(a: Int, v: String) { definedExternally }
@nativeSetter
fun set4(a: Double, v: String): Any = definedExternally
@nativeSetter
fun set5(a: Double, v: String): CharSequence = definedExternally
}
}
external class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj2 {}
}
}
external class C {
@nativeSetter
fun set6(a: Double, v: String): Number = definedExternally
@nativeSetter
fun set(): Any? = definedExternally
@nativeSetter
fun set(a: A): Any? = definedExternally
@nativeSetter
fun set(a: String, v: Any, v2: Any) { definedExternally }
@nativeSetter
fun set(a: A, v: Any?) { definedExternally }
@nativeSetter
fun foo(a: Number, v: String = definedExternally): String = definedExternally
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
@@ -1,92 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
class B {
class A {
@nativeSetter
fun set(a: String, v: Any?): Any? = definedExternally
@nativeSetter
fun put(a: Number, v: String) { definedExternally }
@nativeSetter
fun foo(a: Int, v: String) { definedExternally }
@nativeSetter
fun set4(a: Double, v: String): Any = definedExternally
@nativeSetter
fun set5(a: Double, v: String): CharSequence = definedExternally
companion object {
@nativeSetter
fun set(a: String, v: Any?): Any? = definedExternally
@nativeSetter
fun put(a: Number, v: String) { definedExternally }
@nativeSetter
fun foo(a: Int, v: String) { definedExternally }
@nativeSetter
fun set4(a: Double, v: String): Any = definedExternally
@nativeSetter
fun set5(a: Double, v: String): CharSequence = definedExternally
}
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo: Int = definedExternally
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj2 {}
}
}
class C {
@nativeSetter
fun set6(a: Double, v: String): Number = definedExternally
@nativeSetter
fun set(): Any? = definedExternally
@nativeSetter
fun set(a: A): Any? = definedExternally
@nativeSetter
fun set(a: String, v: Any, v2: Any) { definedExternally }
@nativeSetter
fun set(a: A, v: Any?) { definedExternally }
@nativeSetter
fun foo(a: Double = definedExternally, v: String = definedExternally): String = definedExternally
}
object obj {
@nativeSetter
fun set(): Any? = definedExternally
@nativeSetter
fun set(a: A): Any? = definedExternally
@nativeSetter
fun set(a: String, v: Any, v2: Any) { definedExternally }
@nativeSetter
fun set(a: A, v: Any?) { definedExternally }
@nativeSetter
fun foo(a: Int, v: String = definedExternally): String = definedExternally
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
external class A {
@@ -1,130 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A {
class B {
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"
companion object {
@nativeSetter
fun set(a: String, v: Any?): Any? = null
@nativeSetter
fun put(a: Number, v: String) {}
@nativeSetter
fun foo(a: Int, v: String) {}
}
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj2 {}
}
}
class C {
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?) = "OK"
@nativeSetter
fun Int.set3(a: Double, v: String?) = "OK"
@nativeSetter
fun Int.set6(a: Double, v: String): Number = 1
@nativeSetter
fun set(): Any? = null
@nativeSetter
fun set(a: A): Any? = null
@nativeSetter
fun set(a: String, v: Any, v2: Any) {}
@nativeSetter
fun set(a: A, v: Any?) {}
@nativeSetter
fun foo(a: Double = 0.0, v: String = "str") = "OK"
}
object obj {
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?) = "OK"
@nativeSetter
fun Int.set3(a: Double, v: String?) = "OK"
@nativeSetter
fun set(): Any? = null
@nativeSetter
fun set(a: A): Any? = null
@nativeSetter
fun set(a: String, v: Any, v2: Any) {}
@nativeSetter
fun set(a: A, v: Any?) {}
@nativeSetter
fun foo(a: Int, v: String = "str") = "OK"
}
val anonymous = object {
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?) = "OK"
@nativeSetter
fun Int.set3(a: Double, v: String?) = "OK"
@nativeSetter
fun set(): Any? = null
@nativeSetter
fun set(a: A): Any? = null
@nativeSetter
fun set(a: String, v: Any, v2: Any) {}
@nativeSetter
fun set(a: A, v: Any?) {}
@nativeSetter
fun foo(a: Number = 0.0, v: String) = "OK"
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
class A {
@@ -1,65 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
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) {}
companion object {
@nativeSetter
fun set(a: String, v: Any?): Any? = null
@nativeSetter
fun put(a: Number, v: String) {}
@nativeSetter
fun foo(a: Int, v: String) {}
}
}
class B {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj1 {}
companion object {
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val foo = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
object Obj2 {}
}
}
class C {
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?) = "OK"
@nativeSetter
fun Int.set3(a: Double, v: String?) = "OK"
@nativeSetter
fun set(): Any? = null
@nativeSetter
fun set(a: A): Any? = null
@nativeSetter
fun set(a: String, v: Any, v2: Any) {}
@nativeSetter
fun set(a: A, v: Any?) {}
@nativeSetter
fun foo(a: String = "0.0", v: String) = "OK"
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
class A {
@@ -1,31 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeSetter
fun Int.set(a: String, v: Int) {}
@nativeSetter
fun Int.set2(a: Number, v: String?): Any? = null
@nativeSetter
fun Int.set3(a: Double, v: String) = "OK"
@nativeSetter
fun Int.set4(a: Double, v: String): Any = 1
@nativeSetter
fun Int.set5(a: Double, v: String): CharSequence = "OK"
@nativeSetter
fun Int.set6(a: Double, v: String): Number = 1
@nativeSetter
fun Any.foo(a: String = "0.0", v: String = "str") = "OK"
@nativeSetter
fun Int.set(a: <!UNRESOLVED_REFERENCE!>A<!>): Int? = 1
@nativeSetter
fun Int.set2(): String? = "OK"
@nativeSetter
fun Int.set3(a: Any, b: Int, c: Any?) {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeSetter
@@ -1,10 +0,0 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
@nativeSetter
fun toplevelFun(): Any = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
val toplevelVal = 0
<!WRONG_ANNOTATION_TARGET!>@nativeSetter<!>
class Foo {}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
<!NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN, NATIVE_INDEXER_WRONG_PARAMETER_COUNT!>@nativeSetter