[FIR JS] Implement FirJsNativeAnnotationChecker
This commit is contained in:
committed by
Space Team
parent
a20e29e8b7
commit
5b3a73f7cd
Vendored
-33
@@ -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
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
fun foo() {
|
||||
|
||||
-45
@@ -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"
|
||||
}
|
||||
}
|
||||
Vendored
+2
-1
@@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-12
@@ -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 {}
|
||||
}
|
||||
Vendored
+2
-1
@@ -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 {}
|
||||
}
|
||||
}
|
||||
Vendored
-71
@@ -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
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
external class A {
|
||||
|
||||
-92
@@ -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
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
external class A {
|
||||
|
||||
-130
@@ -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
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||
|
||||
class A {
|
||||
|
||||
Vendored
-65
@@ -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"
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
class A {
|
||||
|
||||
Vendored
-31
@@ -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?) {}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
@nativeSetter
|
||||
|
||||
-10
@@ -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 {}
|
||||
Vendored
+1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user