[FIR JS] Implement FirJsNativeAnnotationChecker
This commit is contained in:
committed by
Space Team
parent
a20e29e8b7
commit
5b3a73f7cd
Vendored
-24
@@ -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
@@ -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 {
|
||||
@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
|
||||
}
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -NON_TOPLEVEL_CLASS_DECLARATION, -DEPRECATION
|
||||
|
||||
fun foo() {
|
||||
|
||||
Vendored
-12
@@ -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 {}
|
||||
}
|
||||
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!>@nativeGetter<!>
|
||||
class Foo {}
|
||||
}
|
||||
}
|
||||
Vendored
-57
@@ -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
|
||||
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
external class A {
|
||||
|
||||
-77
@@ -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
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
external class A {
|
||||
|
||||
-112
@@ -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
@@ -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 {
|
||||
@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
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
class A {
|
||||
|
||||
Vendored
-22
@@ -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"
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER, -DEPRECATION
|
||||
|
||||
@nativeGetter
|
||||
|
||||
-10
@@ -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 {}
|
||||
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!>@nativeGetter
|
||||
|
||||
Reference in New Issue
Block a user