[K/JS] Generate unstable names on Frontend-checks for declarations with the JsExport.Ignore annotation ^KT-60202 Fixed

This commit is contained in:
Artem Kobzar
2023-07-24 09:52:58 +00:00
committed by Space Team
parent 8ce1417621
commit 53aa8eddfe
5 changed files with 71 additions and 0 deletions
@@ -0,0 +1,29 @@
// FIR_IDENTICAL
// !OPT_IN: kotlin.js.ExperimentalJsExport
// !RENDER_DIAGNOSTICS_MESSAGES
@file:JsExport
package foo
@JsExport.Ignore
inline fun <reified T> inlineReifiedFun(x: Any) = x is T
@JsExport.Ignore
suspend fun suspendFun() { }
@JsExport.Ignore
val String.extensionProperty get() = this.length
@JsExport.Ignore
val Array<*>.extensionProperty get() = this.size
@JsExport.Ignore
annotation class AnnotationClass
class AnotherClass {
@JsExport.Ignore
val String.extensionProperty get() = this.length
@JsExport.Ignore
val Array<*>.extensionProperty get() = this.size
}
@@ -0,0 +1,24 @@
package
package foo {
@kotlin.js.JsExport.Ignore public val kotlin.Array<*>.extensionProperty: kotlin.Int
@kotlin.js.JsExport.Ignore public val kotlin.String.extensionProperty: kotlin.Int
@kotlin.js.JsExport.Ignore public inline fun </*0*/ reified T> inlineReifiedFun(/*0*/ x: kotlin.Any): kotlin.Boolean
@kotlin.js.JsExport.Ignore public suspend fun suspendFun(): kotlin.Unit
@kotlin.js.JsExport.Ignore public final annotation class AnnotationClass : kotlin.Annotation {
public constructor AnnotationClass()
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 final class AnotherClass {
public constructor AnotherClass()
@kotlin.js.JsExport.Ignore public final val kotlin.Array<*>.extensionProperty: kotlin.Int
@kotlin.js.JsExport.Ignore public final val kotlin.String.extensionProperty: kotlin.Int
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
}
}
@@ -514,6 +514,12 @@ public class DiagnosticsTestWithJsStdLibGenerated extends AbstractDiagnosticsTes
public void testWrongExportedDeclarationInExportedFile() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclarationInExportedFile.kt");
}
@Test
@TestMetadata("wrongExportedDeclarationInExportedFileWhenIgnored.kt")
public void testWrongExportedDeclarationInExportedFileWhenIgnored() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclarationInExportedFileWhenIgnored.kt");
}
}
@Nested
@@ -128,6 +128,12 @@ public final class AnnotationsUtils {
}
if (hasAnnotationOrInsideAnnotatedClass(descriptor, JS_EXPORT_IGNORE)) return false;
if (descriptor instanceof PropertyAccessorDescriptor) {
PropertyAccessorDescriptor propertyAccessor = (PropertyAccessorDescriptor) descriptor;
if (propertyAccessor.getCorrespondingProperty().getAnnotations().hasAnnotation(JS_EXPORT_IGNORE)) return false;
}
if (hasAnnotationOrInsideAnnotatedClass(descriptor, JS_EXPORT)) return true;
if (CollectionsKt.any(getContainingFileAnnotations(bindingContext, descriptor), annotation ->
@@ -515,6 +515,12 @@ public class FirPsiJsOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiJ
public void testWrongExportedDeclarationInExportedFile() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclarationInExportedFile.kt");
}
@Test
@TestMetadata("wrongExportedDeclarationInExportedFileWhenIgnored.kt")
public void testWrongExportedDeclarationInExportedFileWhenIgnored() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/export/wrongExportedDeclarationInExportedFileWhenIgnored.kt");
}
}
@Nested