diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.kt new file mode 100644 index 00000000000..16b80e264a9 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.kt @@ -0,0 +1,21 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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" +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.kt new file mode 100644 index 00000000000..cb8996b34c4 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.kt @@ -0,0 +1,36 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo() { + [native] + class A { + nativeGetter + fun get(a: String): Any? = null + + nativeGetter + fun take(a: Number): String? = null + + nativeGetter + fun foo(a: Double): String? = null + } + + [native] + class B { + nativeGetter + val foo = 0 + } + + [native] + 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 + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.kt new file mode 100644 index 00000000000..c93f27d09d4 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.kt @@ -0,0 +1,33 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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 { + nativeGetter + val foo = 0 + } + + 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 + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.kt new file mode 100644 index 00000000000..f66758e103d --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.kt @@ -0,0 +1,12 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE + +fun foo() { + [nativeGetter] + fun toplevelFun(): Any = 0 + + [nativeGetter] + val toplevelVal = 0 + + [nativeGetter] + class Foo {} +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.kt new file mode 100644 index 00000000000..a106d846414 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.kt @@ -0,0 +1,56 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +native +class A { + nativeGetter + fun get(a: String): Any? = null + + nativeGetter + fun take(a: Number): String? = null + + nativeGetter + fun foo(a: Double): String? = null + + class object { + nativeGetter + fun get(a: String): Any? = null + + nativeGetter + fun take(a: Number): String? = null + + nativeGetter + fun foo(a: Double): String? = null + } +} + +native +class B { + nativeGetter + val foo = 0 + + nativeGetter + object Obj1 {} + + class object { + nativeGetter + val foo = 0 + + nativeGetter + object Obj2 {} + } +} + +native +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 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.txt new file mode 100644 index 00000000000..6f603fd3376 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.txt @@ -0,0 +1,76 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +kotlin.js.native() internal final class B { + public constructor B() + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeGetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeGetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : B.Obj1 { + private constructor () + 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 + } + } +} + +kotlin.js.native() internal final class C { + public constructor C() + kotlin.js.nativeGetter() internal final fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.kt new file mode 100644 index 00000000000..15102b3d878 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.kt @@ -0,0 +1,86 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +native +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 + + class 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 + val foo = 0 + + nativeGetter + object Obj1 {} + + class object { + nativeGetter + val foo = 0 + + nativeGetter + object Obj2 {} + } + } + + 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 + } + + 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 + } + + 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 + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt new file mode 100644 index 00000000000..e77f03c8776 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.txt @@ -0,0 +1,113 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + 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 + + internal final class B { + public constructor B() + internal 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 + + internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + internal final class B { + public constructor B() + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeGetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : A.B.B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeGetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : A.B.B.Obj1 { + private constructor () + 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 + } + } + } + + internal final class C { + public constructor C() + kotlin.js.nativeGetter() internal final fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: A.B.A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal object obj { + private constructor obj() + kotlin.js.nativeGetter() internal final fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: A.B.A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public class object : A.B.obj { + private constructor () + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun get(/*0*/ a: A.B.A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.kt new file mode 100644 index 00000000000..d04ef93c73a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.kt @@ -0,0 +1,85 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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 + + class 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 + val foo = 0 + + nativeGetter + object Obj1 {} + + class object { + nativeGetter + val foo = 0 + + nativeGetter + object Obj2 {} + } + } + + 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 + } + + 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 + } + + 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 + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt new file mode 100644 index 00000000000..16b4c0cf55a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.txt @@ -0,0 +1,113 @@ +package + +internal final class A { + public constructor A() + 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 + + internal final class B { + public constructor B() + internal 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 + + internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + internal final class B { + public constructor B() + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeGetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : A.B.B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeGetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : A.B.B.Obj1 { + private constructor () + 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 + } + } + } + + internal final class C { + public constructor C() + kotlin.js.nativeGetter() internal final fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: A.B.A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal object obj { + private constructor obj() + kotlin.js.nativeGetter() internal final fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: A.B.A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public class object : A.B.obj { + private constructor () + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final override /*1*/ /*fake_override*/ fun get(/*0*/ a: A.B.A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.kt new file mode 100644 index 00000000000..f34ea0db2d9 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.kt @@ -0,0 +1,53 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +class A { + nativeGetter + fun get(a: String): Any? = null + + nativeGetter + fun take(a: Number): String? = null + + nativeGetter + fun foo(a: Double): String? = null + + class 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 + val foo = 0 + + nativeGetter + object Obj1 {} + + class object { + nativeGetter + val foo = 0 + + nativeGetter + object Obj2 {} + } +} + +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 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.txt new file mode 100644 index 00000000000..290cf76ce11 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.txt @@ -0,0 +1,76 @@ +package + +internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Double): kotlin.String? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: kotlin.String): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeGetter() internal final fun take(/*0*/ a: kotlin.Number): kotlin.String? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +internal final class B { + public constructor B() + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeGetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeGetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeGetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : B.Obj1 { + private constructor () + 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 + } + } +} + +internal final class C { + public constructor C() + kotlin.js.nativeGetter() internal final fun bar(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeGetter() internal final fun foo(/*0*/ a: kotlin.Int): kotlin.Unit + kotlin.js.nativeGetter() internal final fun get(): kotlin.Any? + kotlin.js.nativeGetter() internal final fun get(/*0*/ a: A): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.kt new file mode 100644 index 00000000000..eff01cb22ca --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.kt @@ -0,0 +1,19 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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" diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.txt new file mode 100644 index 00000000000..1546d308026 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.txt @@ -0,0 +1,8 @@ +package + +kotlin.js.nativeGetter() internal fun kotlin.Int.get(/*0*/ a: kotlin.Any): kotlin.Int? +kotlin.js.nativeGetter() internal fun kotlin.Int.get(/*0*/ a: kotlin.String): kotlin.Int? +kotlin.js.nativeGetter() internal fun kotlin.Int.get2(): kotlin.String? +kotlin.js.nativeGetter() internal fun kotlin.Int.get2(/*0*/ a: kotlin.Number): kotlin.String? +kotlin.js.nativeGetter() internal fun kotlin.Int.get3(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Any?): kotlin.String? +kotlin.js.nativeGetter() internal fun kotlin.Int.get3(/*0*/ a: kotlin.Int): kotlin.String? diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.kt new file mode 100644 index 00000000000..f4fbe0cbdb2 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.kt @@ -0,0 +1,10 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +nativeGetter +fun toplevelFun(): Any = 0 + +nativeGetter +val toplevelVal = 0 + +nativeGetter +class Foo {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.txt new file mode 100644 index 00000000000..3d226c644c7 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.txt @@ -0,0 +1,11 @@ +package + +kotlin.js.nativeGetter() internal val toplevelVal: kotlin.Int = 0 +kotlin.js.nativeGetter() internal fun toplevelFun(): kotlin.Any + +kotlin.js.nativeGetter() internal final class Foo { + public constructor Foo() + 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 +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.kt new file mode 100644 index 00000000000..38158509724 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.kt @@ -0,0 +1,9 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo() { + [nativeInvoke] + fun Int.ext() = 1 + + [nativeInvoke] + fun Int.invoke(a: String, b: Int) = "OK" +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.kt new file mode 100644 index 00000000000..5eb97515e45 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.kt @@ -0,0 +1,20 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo() { + [native] + class A { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + + val anonymous = object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.kt new file mode 100644 index 00000000000..0ff4efa5847 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.kt @@ -0,0 +1,19 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo() { + class A { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + + val anonymous = object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.kt new file mode 100644 index 00000000000..cfeff793c9f --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.kt @@ -0,0 +1,12 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE + +fun foo() { + [nativeInvoke] + fun toplevelFun() {} + + [nativeInvoke] + val toplevelVal = 0 + + [nativeInvoke] + class Foo {} +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.kt new file mode 100644 index 00000000000..8b195dce20c --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.kt @@ -0,0 +1,24 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +native +class A { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + + nativeInvoke + val foo = 0 + + nativeInvoke + object Obj {} + + class object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.txt new file mode 100644 index 00000000000..dd7ec9cfcd7 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.txt @@ -0,0 +1,34 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + kotlin.js.nativeInvoke() internal final val foo: kotlin.Int = 0 + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + kotlin.js.nativeInvoke() internal object Obj { + private constructor Obj() + 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 + + public class object : A.Obj { + private constructor () + 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 + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.kt new file mode 100644 index 00000000000..7f9fcc36ec9 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.kt @@ -0,0 +1,38 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +native +class A { + class B { + class C { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + + object obj { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + + class object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + + val anonymous = object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt new file mode 100644 index 00000000000..12ac1365884 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.txt @@ -0,0 +1,52 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + 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 + + internal final class B { + public constructor B() + internal 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 + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal object obj { + private constructor obj() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public class object : A.B.obj { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final override /*1*/ /*fake_override*/ fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.kt new file mode 100644 index 00000000000..5481f075bf5 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.kt @@ -0,0 +1,37 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +class A { + class B { + class C { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + + object obj { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + + class object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + + val anonymous = object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt new file mode 100644 index 00000000000..c3eff356958 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.txt @@ -0,0 +1,52 @@ +package + +internal final class A { + public constructor A() + 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 + + internal final class B { + public constructor B() + internal 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 + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal object obj { + private constructor obj() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public class object : A.B.obj { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final override /*1*/ /*fake_override*/ fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.kt new file mode 100644 index 00000000000..a5ab450fbe4 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.kt @@ -0,0 +1,23 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +class A { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + + nativeInvoke + val foo = 0 + + nativeInvoke + object Obj {} + + class object { + nativeInvoke + fun foo() {} + + nativeInvoke + fun invoke(a: String): Int = 0 + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.txt new file mode 100644 index 00000000000..bbc18249927 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.txt @@ -0,0 +1,34 @@ +package + +internal final class A { + public constructor A() + kotlin.js.nativeInvoke() internal final val foo: kotlin.Int = 0 + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeInvoke() internal final fun foo(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeInvoke() internal final fun invoke(/*0*/ a: kotlin.String): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + kotlin.js.nativeInvoke() internal object Obj { + private constructor Obj() + 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 + + public class object : A.Obj { + private constructor () + 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 + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.kt new file mode 100644 index 00000000000..9783e3c0c56 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.kt @@ -0,0 +1,7 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +nativeInvoke +fun Int.ext() = 1 + +nativeInvoke +fun Int.invoke(a: String, b: Int) = "OK" diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.txt new file mode 100644 index 00000000000..833f9ebd29a --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.txt @@ -0,0 +1,4 @@ +package + +kotlin.js.nativeInvoke() internal fun kotlin.Int.ext(): kotlin.Int +kotlin.js.nativeInvoke() internal fun kotlin.Int.invoke(/*0*/ a: kotlin.String, /*1*/ b: kotlin.Int): kotlin.String diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.kt new file mode 100644 index 00000000000..49b0d30fead --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.kt @@ -0,0 +1,10 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +nativeInvoke +fun toplevelFun() {} + +nativeInvoke +val toplevelVal = 0 + +nativeInvoke +class Foo {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.txt new file mode 100644 index 00000000000..e91a4922843 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.txt @@ -0,0 +1,11 @@ +package + +kotlin.js.nativeInvoke() internal val toplevelVal: kotlin.Int = 0 +kotlin.js.nativeInvoke() internal fun toplevelFun(): kotlin.Unit + +kotlin.js.nativeInvoke() internal final class Foo { + public constructor Foo() + 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 +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.kt new file mode 100644 index 00000000000..dcb9ee5c63f --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.kt @@ -0,0 +1,21 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +fun foo() { + [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.set(a: Any): Int? = 1 + + [nativeSetter] + fun Int.set2(): String? = "OK" + + [nativeSetter] + fun Int.set3(a: Any, b: Int, c: Any?) {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.kt new file mode 100644 index 00000000000..fc0fd13ecc8 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.kt @@ -0,0 +1,36 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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) {} + } + + [native] + class B { + nativeSetter + val foo = 0 + } + + [native] + class C { + 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?) {} + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.kt new file mode 100644 index 00000000000..d7de3e7062e --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.kt @@ -0,0 +1,33 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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 { + nativeSetter + var foo = 0 + } + + class C { + 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?) {} + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.kt new file mode 100644 index 00000000000..9163557a454 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.kt @@ -0,0 +1,12 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE + +fun foo() { + [nativeSetter] + fun toplevelFun(): Any = 0 + + [nativeSetter] + val toplevelVal = 0 + + [nativeSetter] + class Foo {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.txt new file mode 100644 index 00000000000..093bfc34070 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.txt @@ -0,0 +1,3 @@ +package + +internal fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.kt new file mode 100644 index 00000000000..74418783a74 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.kt @@ -0,0 +1,56 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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) {} + + class object { + nativeSetter + fun set(a: String, v: Any?): Any? = null + + nativeSetter + fun put(a: Number, v: String) {} + + nativeSetter + fun foo(a: Int, v: String) {} + } +} + +native +class B { + nativeSetter + val foo = 0 + + nativeSetter + object Obj1 {} + + class object { + nativeSetter + val foo = 0 + + nativeSetter + object Obj2 {} + } +} + +native +class C { + 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?) {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.txt new file mode 100644 index 00000000000..0e0bc9b67cd --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.txt @@ -0,0 +1,76 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +kotlin.js.native() internal final class B { + public constructor B() + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeSetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeSetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : B.Obj1 { + private constructor () + 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 + } + } +} + +kotlin.js.native() internal final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.kt new file mode 100644 index 00000000000..38f666feab2 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.kt @@ -0,0 +1,86 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +native +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) {} + + class 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 { + nativeSetter + val foo = 0 + + nativeSetter + object Obj1 {} + + class object { + nativeSetter + val foo = 0 + + nativeSetter + object Obj2 {} + } + } + + class C { + 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?) {} + } + + object obj { + 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?) {} + } + + val anonymous = object { + 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?) {} + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt new file mode 100644 index 00000000000..23a3aeeb4f1 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.txt @@ -0,0 +1,113 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + 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 + + internal final class B { + public constructor B() + internal 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 + + internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + internal final class B { + public constructor B() + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeSetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : A.B.B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeSetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : A.B.B.Obj1 { + private constructor () + 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 + } + } + } + + internal final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal object obj { + private constructor obj() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public class object : A.B.obj { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(/*0*/ a: A.B.A): kotlin.Any? + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.kt new file mode 100644 index 00000000000..38f666feab2 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.kt @@ -0,0 +1,86 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +native +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) {} + + class 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 { + nativeSetter + val foo = 0 + + nativeSetter + object Obj1 {} + + class object { + nativeSetter + val foo = 0 + + nativeSetter + object Obj2 {} + } + } + + class C { + 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?) {} + } + + object obj { + 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?) {} + } + + val anonymous = object { + 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?) {} + } + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt new file mode 100644 index 00000000000..23a3aeeb4f1 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.txt @@ -0,0 +1,113 @@ +package + +kotlin.js.native() internal final class A { + public constructor A() + 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 + + internal final class B { + public constructor B() + internal 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 + + internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + + internal final class B { + public constructor B() + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeSetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : A.B.B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeSetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : A.B.B.Obj1 { + private constructor () + 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 + } + } + } + + internal final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + + internal object obj { + private constructor obj() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + public class object : A.B.obj { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(/*0*/ a: A.B.A): kotlin.Any? + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(/*0*/ a: A.B.A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final override /*1*/ /*fake_override*/ fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } + } + } +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.kt new file mode 100644 index 00000000000..8165b51a010 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.kt @@ -0,0 +1,53 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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 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 { + nativeSetter + val foo = 0 + + nativeSetter + object Obj1 {} + + class object { + nativeSetter + val foo = 0 + + nativeSetter + object Obj2 {} + } +} + +class C { + 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?) {} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.txt new file mode 100644 index 00000000000..391e098efb0 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.txt @@ -0,0 +1,76 @@ +package + +internal final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + internal class object { + private constructor () + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + kotlin.js.nativeSetter() internal final fun foo(/*0*/ a: kotlin.Int, /*1*/ v: kotlin.String): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun put(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any?): kotlin.Any? + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} + +internal final class B { + public constructor B() + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + internal class object { + private constructor () + kotlin.js.nativeSetter() internal final val foo: kotlin.Int = 0 + 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 + + kotlin.js.nativeSetter() internal object Obj2 { + private constructor Obj2() + 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 + + public class object : B.Obj2 { + private constructor () + 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 + } + } + } + + kotlin.js.nativeSetter() internal object Obj1 { + private constructor Obj1() + 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 + + public class object : B.Obj1 { + private constructor () + 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 + } + } +} + +internal final class C { + public constructor C() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + kotlin.js.nativeSetter() internal final fun set(): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A): kotlin.Any? + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: A, /*1*/ v: kotlin.Any?): kotlin.Unit + kotlin.js.nativeSetter() internal final fun set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Any, /*2*/ v2: kotlin.Any): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.kt new file mode 100644 index 00000000000..ce37c329dd0 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.kt @@ -0,0 +1,19 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +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.set(a: A): Int? = 1 + +nativeSetter +fun Int.set2(): String? = "OK" + +nativeSetter +fun Int.set3(a: Any, b: Int, c: Any?) {} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.txt new file mode 100644 index 00000000000..fee7d3394a1 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.txt @@ -0,0 +1,8 @@ +package + +kotlin.js.nativeSetter() internal fun kotlin.Int.set(/*0*/ a: [ERROR : A]): kotlin.Int? +kotlin.js.nativeSetter() internal fun kotlin.Int.set(/*0*/ a: kotlin.String, /*1*/ v: kotlin.Int): kotlin.Unit +kotlin.js.nativeSetter() internal fun kotlin.Int.set2(): kotlin.String? +kotlin.js.nativeSetter() internal fun kotlin.Int.set2(/*0*/ a: kotlin.Number, /*1*/ v: kotlin.String?): kotlin.String +kotlin.js.nativeSetter() internal fun kotlin.Int.set3(/*0*/ a: kotlin.Any, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Any?): kotlin.Unit +kotlin.js.nativeSetter() internal fun kotlin.Int.set3(/*0*/ a: kotlin.Double, /*1*/ v: kotlin.String?): kotlin.String diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.kt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.kt new file mode 100644 index 00000000000..844bba29146 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.kt @@ -0,0 +1,10 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +nativeSetter +fun toplevelFun(): Any = 0 + +nativeSetter +val toplevelVal = 0 + +nativeSetter +class Foo {} \ No newline at end of file diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.txt b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.txt new file mode 100644 index 00000000000..f0d58fae4e3 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.txt @@ -0,0 +1,11 @@ +package + +kotlin.js.nativeSetter() internal val toplevelVal: kotlin.Int = 0 +kotlin.js.nativeSetter() internal fun toplevelFun(): kotlin.Any + +kotlin.js.nativeSetter() internal final class Foo { + public constructor Foo() + 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 +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java index e56bfb6a515..17ae086cbdb 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java +++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java @@ -145,7 +145,7 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest { StringBuilder actualText = new StringBuilder(); for (TestFile testFile : testFiles) { - ok &= testFile.getActualText(moduleBindings.get(testFile.getModule()), actualText, groupedByModule.size() > 1); + ok &= testFile.getActualText(moduleBindings.get(testFile.getModule()), actualText, shouldSkipJvmSignatureDiagnostics(groupedByModule)); } JetTestUtils.assertEqualsToFile(testDataFile, actualText.toString()); @@ -161,6 +161,10 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest { } } + public boolean shouldSkipJvmSignatureDiagnostics(Map> groupedByModule) { + return groupedByModule.size() > 1; + } + @Nullable private static Throwable checkLazyResolveLog(LazyOperationsLog lazyOperationsLog, File testDataFile) { Throwable exceptionFromLazyResolveLogValidation = null; @@ -261,8 +265,8 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest { for (TestModule testModule : groupedByModule.keySet()) { ModuleDescriptorImpl module = testModule == null ? - TopDownAnalyzerFacadeForJVM.createSealedJavaModule() : - createModule(testModule); + createSealedModule() : + createModule("<" + testModule.getName() + ">"); modules.put(testModule, module); } @@ -283,9 +287,13 @@ public abstract class AbstractJetDiagnosticsTest extends BaseDiagnosticsTest { return modules; } - protected ModuleDescriptorImpl createModule(TestModule testModule) { - String name = "<" + testModule.getName() + ">"; - return TopDownAnalyzerFacadeForJVM.createJavaModule(name); + protected ModuleDescriptorImpl createModule(String moduleName) { + return TopDownAnalyzerFacadeForJVM.createJavaModule(moduleName); + } + + @NotNull + protected ModuleDescriptorImpl createSealedModule() { + return TopDownAnalyzerFacadeForJVM.createSealedJavaModule(); } private static void checkAllResolvedCallsAreCompleted(@NotNull List jetFiles, @NotNull BindingContext bindingContext) { diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTestWithJsStdLib.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTestWithJsStdLib.java new file mode 100644 index 00000000000..180eccf30d4 --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTestWithJsStdLib.java @@ -0,0 +1,106 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.checkers; + +import com.google.common.base.Predicates; +import com.intellij.openapi.Disposable; +import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.cli.jvm.compiler.EnvironmentConfigFiles; +import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; +import org.jetbrains.jet.config.CompilerConfiguration; +import org.jetbrains.jet.context.GlobalContext; +import org.jetbrains.jet.lang.descriptors.ModuleDescriptor; +import org.jetbrains.jet.lang.descriptors.impl.ModuleDescriptorImpl; +import org.jetbrains.jet.lang.psi.JetFile; +import org.jetbrains.jet.lang.resolve.BindingContext; +import org.jetbrains.jet.lang.resolve.BindingTrace; +import org.jetbrains.jet.lang.resolve.DelegatingBindingTrace; +import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; +import org.jetbrains.k2js.analyze.TopDownAnalyzerFacadeForJS; +import org.jetbrains.k2js.config.EcmaVersion; +import org.jetbrains.k2js.config.LibrarySourcesConfigWithCaching; + +import java.util.List; +import java.util.Map; + +public abstract class AbstractJetDiagnosticsTestWithJsStdLib extends AbstractJetDiagnosticsTest { + + private LibrarySourcesConfigWithCaching config; + + @Override + protected void setUp() throws Exception { + super.setUp(); + config = new LibrarySourcesConfigWithCaching(getProject(), "module", EcmaVersion.defaultVersion(), false, true, false); + } + + @Override + protected void tearDown() throws Exception { + config = null; + super.tearDown(); + } + + @Override + @NotNull + protected JetCoreEnvironment createEnvironment(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) { + return JetCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JS_CONFIG_FILES); + } + + @Override + protected void analyzeModuleContents( + GlobalContext context, + List jetFiles, + ModuleDescriptorImpl module, + BindingTrace moduleTrace + ) { + BindingContext libraryContext = config.getLibraryContext(); + DelegatingBindingTrace trace = new DelegatingBindingTrace(libraryContext, "trace with preanalyzed library"); + + TopDownAnalyzerFacadeForJS.analyzeFilesWithGivenTrace(jetFiles, moduleTrace, module, Predicates.alwaysTrue(), config); + + trace.addAllMyDataTo(moduleTrace); + } + + @Override + public boolean shouldSkipJvmSignatureDiagnostics(Map> groupedByModule) { + return true; + } + + @Override + protected ModuleDescriptorImpl createModule(String moduleName) { + return TopDownAnalyzerFacadeForJS.createJsModule(moduleName); + } + + @NotNull + @Override + protected ModuleDescriptorImpl createSealedModule() { + //It's JVM specific thing, so for JS we just create and setup module. + + ModuleDescriptorImpl module = createModule(""); + + module.addDependencyOnModule(module); + module.addDependencyOnModule(KotlinBuiltIns.getInstance().getBuiltInsModule()); + + ModuleDescriptor libraryModule = config.getLibraryModule(); + assert libraryModule instanceof ModuleDescriptorImpl; + module.addDependencyOnModule((ModuleDescriptorImpl) libraryModule); + + module.seal(); + + return module; + } +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithJsStdLibGenerated.java b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithJsStdLibGenerated.java new file mode 100644 index 00000000000..2d6ff65936e --- /dev/null +++ b/compiler/tests/org/jetbrains/jet/checkers/JetDiagnosticsTestWithJsStdLibGenerated.java @@ -0,0 +1,256 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.checkers; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.jet.JUnit3RunnerWithInners; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; +import org.jetbrains.jet.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib") +@TestDataPath("$PROJECT_ROOT") +@InnerTestClasses({JetDiagnosticsTestWithJsStdLibGenerated.Native.class}) +@RunWith(JUnit3RunnerWithInners.class) +public class JetDiagnosticsTestWithJsStdLibGenerated extends AbstractJetDiagnosticsTestWithJsStdLib { + public void testAllFilesPresentInTestsWithJsStdLib() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native") + @TestDataPath("$PROJECT_ROOT") + @InnerTestClasses({Native.NativeGetter.class, Native.NativeInvoke.class, Native.NativeSetter.class}) + @RunWith(JUnit3RunnerWithInners.class) + public static class Native extends AbstractJetDiagnosticsTestWithJsStdLib { + public void testAllFilesPresentInNative() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NativeGetter extends AbstractJetDiagnosticsTestWithJsStdLib { + public void testAllFilesPresentInNativeGetter() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("onLocalExtensionFun.kt") + public void testOnLocalExtensionFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalExtensionFun.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalNativeClassMembers.kt") + public void testOnLocalNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalNonNativeClassMembers.kt") + public void testOnLocalNonNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalNonNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalOtherDeclarations.kt") + public void testOnLocalOtherDeclarations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onLocalOtherDeclarations.kt"); + doTest(fileName); + } + + @TestMetadata("onNativeClassMembers.kt") + public void testOnNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onNestedDeclarationsInsideNativeClass.kt") + public void testOnNestedDeclarationsInsideNativeClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNativeClass.kt"); + doTest(fileName); + } + + @TestMetadata("onNestedDeclarationsInsideNonNativeClass.kt") + public void testOnNestedDeclarationsInsideNonNativeClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNestedDeclarationsInsideNonNativeClass.kt"); + doTest(fileName); + } + + @TestMetadata("onNonNativeClassMembers.kt") + public void testOnNonNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onNonNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onToplevelExtensionFun.kt") + public void testOnToplevelExtensionFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelExtensionFun.kt"); + doTest(fileName); + } + + @TestMetadata("onToplevelOtherDeclarations.kt") + public void testOnToplevelOtherDeclarations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeGetter/onToplevelOtherDeclarations.kt"); + doTest(fileName); + } + } + + @TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NativeInvoke extends AbstractJetDiagnosticsTestWithJsStdLib { + public void testAllFilesPresentInNativeInvoke() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("onLocalExtensionFun.kt") + public void testOnLocalExtensionFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalExtensionFun.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalNativeClassMembers.kt") + public void testOnLocalNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalNonNativeClassMembers.kt") + public void testOnLocalNonNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalNonNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalOtherDeclarations.kt") + public void testOnLocalOtherDeclarations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onLocalOtherDeclarations.kt"); + doTest(fileName); + } + + @TestMetadata("onNativeClassMembers.kt") + public void testOnNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onNestedDeclarationsInsideNativeClass.kt") + public void testOnNestedDeclarationsInsideNativeClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNativeClass.kt"); + doTest(fileName); + } + + @TestMetadata("onNestedDeclarationsInsideNonNativeClass.kt") + public void testOnNestedDeclarationsInsideNonNativeClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNestedDeclarationsInsideNonNativeClass.kt"); + doTest(fileName); + } + + @TestMetadata("onNonNativeClassMembers.kt") + public void testOnNonNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onNonNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onToplevelExtensionFun.kt") + public void testOnToplevelExtensionFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelExtensionFun.kt"); + doTest(fileName); + } + + @TestMetadata("onToplevelOtherDeclarations.kt") + public void testOnToplevelOtherDeclarations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeInvoke/onToplevelOtherDeclarations.kt"); + doTest(fileName); + } + } + + @TestMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NativeSetter extends AbstractJetDiagnosticsTestWithJsStdLib { + public void testAllFilesPresentInNativeSetter() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("onLocalExtensionFun.kt") + public void testOnLocalExtensionFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalExtensionFun.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalNativeClassMembers.kt") + public void testOnLocalNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalNonNativeClassMembers.kt") + public void testOnLocalNonNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalNonNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onLocalOtherDeclarations.kt") + public void testOnLocalOtherDeclarations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onLocalOtherDeclarations.kt"); + doTest(fileName); + } + + @TestMetadata("onNativeClassMembers.kt") + public void testOnNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onNestedDeclarationsInsideNativeClass.kt") + public void testOnNestedDeclarationsInsideNativeClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNativeClass.kt"); + doTest(fileName); + } + + @TestMetadata("onNestedDeclarationsInsideNonNativeClass.kt") + public void testOnNestedDeclarationsInsideNonNativeClass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNestedDeclarationsInsideNonNativeClass.kt"); + doTest(fileName); + } + + @TestMetadata("onNonNativeClassMembers.kt") + public void testOnNonNativeClassMembers() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onNonNativeClassMembers.kt"); + doTest(fileName); + } + + @TestMetadata("onToplevelExtensionFun.kt") + public void testOnToplevelExtensionFun() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelExtensionFun.kt"); + doTest(fileName); + } + + @TestMetadata("onToplevelOtherDeclarations.kt") + public void testOnToplevelOtherDeclarations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithJsStdLib/native/nativeSetter/onToplevelOtherDeclarations.kt"); + doTest(fileName); + } + } + } +} diff --git a/compiler/tests/org/jetbrains/jet/checkers/KotlinMultiFileTestWithWithJava.java b/compiler/tests/org/jetbrains/jet/checkers/KotlinMultiFileTestWithWithJava.java index 72906665ebe..97e41246665 100644 --- a/compiler/tests/org/jetbrains/jet/checkers/KotlinMultiFileTestWithWithJava.java +++ b/compiler/tests/org/jetbrains/jet/checkers/KotlinMultiFileTestWithWithJava.java @@ -17,6 +17,7 @@ package org.jetbrains.jet.checkers; import com.google.common.io.Files; +import com.intellij.openapi.Disposable; import com.intellij.openapi.util.io.FileUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -74,7 +75,12 @@ public abstract class KotlinMultiFileTestWithWithJava extends JetLiteFixtu if (kotlinSourceRoot != null) { configuration.add(CommonConfigurationKeys.SOURCE_ROOTS_KEY, kotlinSourceRoot.getPath()); } - return JetCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES); + return createEnvironment(getTestRootDisposable(), configuration); + } + + @NotNull + protected JetCoreEnvironment createEnvironment(@NotNull Disposable disposable, @NotNull CompilerConfiguration configuration) { + return JetCoreEnvironment.createForTests(disposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES); } @Nullable diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index 7a4ebd7ba60..b33b22889a6 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -132,6 +132,7 @@ import org.jetbrains.jet.plugin.decompiler.textBuilder.AbstractDecompiledTextTes import org.jetbrains.jet.completion.AbstractMultiFileSmartCompletionTest import org.jetbrains.jet.completion.handlers.AbstractCompletionCharFilterTest import org.jetbrains.jet.resolve.AbstractPartialBodyResolveTest +import org.jetbrains.jet.checkers.AbstractJetDiagnosticsTestWithJsStdLib fun main(args: Array) { System.setProperty("java.awt.headless", "true") @@ -148,6 +149,10 @@ fun main(args: Array) { model("diagnostics/testsWithStdLib") } + testClass(javaClass()) { + model("diagnostics/testsWithJsStdLib") + } + testClass(javaClass()) { model("resolve", extension = "resolve") } diff --git a/idea/tests/org/jetbrains/jet/completion/JvmSmartCompletionTestGenerated.java b/idea/tests/org/jetbrains/jet/completion/JvmSmartCompletionTestGenerated.java index 407afdba436..18bf237dae1 100644 --- a/idea/tests/org/jetbrains/jet/completion/JvmSmartCompletionTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/completion/JvmSmartCompletionTestGenerated.java @@ -19,6 +19,7 @@ package org.jetbrains.jet.completion; import com.intellij.testFramework.TestDataPath; import org.jetbrains.jet.JUnit3RunnerWithInners; import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.test.InnerTestClasses; import org.jetbrains.jet.test.TestMetadata; import org.junit.runner.RunWith;