diff --git a/compiler/testData/codegen/box/intrinsics/incWithLabel.kt b/compiler/testData/codegen/box/intrinsics/incWithLabel.kt index 412417ca52d..fff72ffb135 100644 --- a/compiler/testData/codegen/box/intrinsics/incWithLabel.kt +++ b/compiler/testData/codegen/box/intrinsics/incWithLabel.kt @@ -1,6 +1,3 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - fun box(): String { var x = 1 (foo@ x)++ diff --git a/compiler/testData/codegen/box/lazyCodegen/increment.kt b/compiler/testData/codegen/box/lazyCodegen/increment.kt index 642d5798a9b..40369fff4af 100644 --- a/compiler/testData/codegen/box/lazyCodegen/increment.kt +++ b/compiler/testData/codegen/box/lazyCodegen/increment.kt @@ -1,6 +1,3 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - var holder = "" var globalA: A = A(-1) get(): A { diff --git a/compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt b/compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt new file mode 100644 index 00000000000..ef6ec161a84 --- /dev/null +++ b/compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt @@ -0,0 +1,13 @@ +@Target(AnnotationTarget.EXPRESSION) +annotation class Annotation + +fun box(): String { + var v = 0 + @Annotation v += 1 + 2 + if (v != 3) return "fail1" + + @Annotation v = 4 + if (v != 4) return "fail2" + + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/properties/kt613.kt b/compiler/testData/codegen/box/properties/kt613.kt index 91ca043e0ec..4f55c044844 100644 --- a/compiler/testData/codegen/box/properties/kt613.kt +++ b/compiler/testData/codegen/box/properties/kt613.kt @@ -1,6 +1,3 @@ -// TODO: muted automatically, investigate should it be ran for JS or not -// IGNORE_BACKEND: JS - package name class Test() { diff --git a/compiler/testData/codegen/light-analysis/operatorConventions/annotatedAssignment.txt b/compiler/testData/codegen/light-analysis/operatorConventions/annotatedAssignment.txt new file mode 100644 index 00000000000..00eb437f0a0 --- /dev/null +++ b/compiler/testData/codegen/light-analysis/operatorConventions/annotatedAssignment.txt @@ -0,0 +1,8 @@ +public final class AnnotatedAssignmentKt { + public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String +} + +@kotlin.annotation.Target +@java.lang.annotation.Retention +@java.lang.annotation.Target +public annotation class Annotation diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 69198ee0a0f..f6e4af09a4a 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -10487,6 +10487,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/operatorConventions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("annotatedAssignment.kt") + public void testAnnotatedAssignment() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt"); + doTest(fileName); + } + @TestMetadata("assignmentOperations.kt") public void testAssignmentOperations() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/assignmentOperations.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index a42b08a101e..e3d56947c17 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -10487,6 +10487,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/operatorConventions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("annotatedAssignment.kt") + public void testAnnotatedAssignment() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt"); + doTest(fileName); + } + @TestMetadata("assignmentOperations.kt") public void testAssignmentOperations() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/assignmentOperations.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java index 302ab6f7750..8e539eee417 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java @@ -10487,6 +10487,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/operatorConventions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("annotatedAssignment.kt") + public void testAnnotatedAssignment() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt"); + doTest(fileName); + } + @TestMetadata("assignmentOperations.kt") public void testAssignmentOperations() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/assignmentOperations.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index ff09e08b69c..4ccb250ecf2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -9612,13 +9612,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { @TestMetadata("incWithLabel.kt") public void testIncWithLabel() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/intrinsics/incWithLabel.kt"); - try { - doTest(fileName); - } - catch (Throwable ignore) { - return; - } - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + doTest(fileName); } @TestMetadata("kt10131.kt") @@ -10842,13 +10836,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { @TestMetadata("increment.kt") public void testIncrement() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/lazyCodegen/increment.kt"); - try { - doTest(fileName); - } - catch (Throwable ignore) { - return; - } - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + doTest(fileName); } @TestMetadata("safeAssign.kt") @@ -12354,6 +12342,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/operatorConventions"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); } + @TestMetadata("annotatedAssignment.kt") + public void testAnnotatedAssignment() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/annotatedAssignment.kt"); + doTest(fileName); + } + @TestMetadata("assignmentOperations.kt") public void testAssignmentOperations() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/operatorConventions/assignmentOperations.kt"); @@ -13641,13 +13635,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { @TestMetadata("kt613.kt") public void testKt613() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/properties/kt613.kt"); - try { - doTest(fileName); - } - catch (Throwable ignore) { - return; - } - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + doTest(fileName); } @TestMetadata("kt8928.kt") diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/AccessTranslationUtils.java b/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/AccessTranslationUtils.java index 12167986526..0df2dd3924e 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/AccessTranslationUtils.java +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/reference/AccessTranslationUtils.java @@ -30,16 +30,15 @@ public final class AccessTranslationUtils { } @NotNull - public static AccessTranslator getAccessTranslator(@NotNull KtExpression referenceExpression, - @NotNull TranslationContext context) { + public static AccessTranslator getAccessTranslator(@NotNull KtExpression referenceExpression, @NotNull TranslationContext context) { return getAccessTranslator(referenceExpression, context, false); } @NotNull public static AccessTranslator getAccessTranslator(@NotNull KtExpression referenceExpression, @NotNull TranslationContext context, boolean forceOrderOfEvaluation) { - assert ((referenceExpression instanceof KtReferenceExpression) || - (referenceExpression instanceof KtQualifiedExpression)); + referenceExpression = KtPsiUtil.deparenthesize(referenceExpression); + assert referenceExpression != null; if (referenceExpression instanceof KtQualifiedExpression) { return QualifiedExpressionTranslator.getAccessTranslator((KtQualifiedExpression) referenceExpression, context, forceOrderOfEvaluation); } @@ -75,8 +74,7 @@ public final class AccessTranslationUtils { } @NotNull - public static JsExpression translateAsGet(@NotNull KtExpression expression, - @NotNull TranslationContext context) { + public static JsExpression translateAsGet(@NotNull KtExpression expression, @NotNull TranslationContext context) { return (getAccessTranslator(expression, context)).translateAsGet(); } }