From c552933459687274c32cc068d93e48f8f8658d78 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Fri, 10 Jul 2020 02:29:24 +0300 Subject: [PATCH] [Test infra] Take into account transitive compatible targets while checking compatibility. --- .../kotlin/test/InTextDirectivesUtils.java | 9 ++- .../IrJsCodegenBoxES6TestGenerated.java | 55 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/test/InTextDirectivesUtils.java b/compiler/tests-common/tests/org/jetbrains/kotlin/test/InTextDirectivesUtils.java index 32e266d1b02..e54bc1a80fa 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/test/InTextDirectivesUtils.java +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/test/InTextDirectivesUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -231,7 +231,12 @@ public final class InTextDirectivesUtils { return false; List backends = findLinesWithPrefixesRemoved(textWithDirectives(file), "// TARGET_BACKEND: "); - return backends.isEmpty() || backends.contains(targetBackend.name()) || backends.contains(targetBackend.getCompatibleWith().name()); + return isCompatibleTargetExceptAny(targetBackend, backends); + } + + private static boolean isCompatibleTargetExceptAny(TargetBackend targetBackend, List backends) { + if (targetBackend == TargetBackend.ANY) return false; + return backends.isEmpty() || backends.contains(targetBackend.name()) || isCompatibleTargetExceptAny(targetBackend.getCompatibleWith(), backends); } public static boolean isIgnoredTarget(TargetBackend targetBackend, File file, String ignoreBackendDirectivePrefix) { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 0773a5111d9..95b002e70fc 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -1077,6 +1077,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/bridges/genericProperty.kt"); } + @TestMetadata("jsName.kt") + public void testJsName() throws Exception { + runTest("compiler/testData/codegen/box/bridges/jsName.kt"); + } + + @TestMetadata("jsNative.kt") + public void testJsNative() throws Exception { + runTest("compiler/testData/codegen/box/bridges/jsNative.kt"); + } + @TestMetadata("kt12416.kt") public void testKt12416() throws Exception { runTest("compiler/testData/codegen/box/bridges/kt12416.kt"); @@ -15739,6 +15749,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/primitiveTypes/conversions.kt"); } + @TestMetadata("crossTypeEquals.kt") + public void testCrossTypeEquals() throws Exception { + runTest("compiler/testData/codegen/box/primitiveTypes/crossTypeEquals.kt"); + } + @TestMetadata("ea35963.kt") public void testEa35963() throws Exception { runTest("compiler/testData/codegen/box/primitiveTypes/ea35963.kt"); @@ -22297,6 +22312,46 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAllFilesPresentInJs() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/typeOf/js"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @TestMetadata("classes.kt") + public void testClasses() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/classes.kt"); + } + + @TestMetadata("inlineClasses.kt") + public void testInlineClasses() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/inlineClasses.kt"); + } + + @TestMetadata("kType.kt") + public void testKType() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/kType.kt"); + } + + @TestMetadata("manyTypeArguments.kt") + public void testManyTypeArguments() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/manyTypeArguments.kt"); + } + + @TestMetadata("multipleLayers.kt") + public void testMultipleLayers() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/multipleLayers.kt"); + } + + @TestMetadata("multipleModules.kt") + public void testMultipleModules() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/multipleModules.kt"); + } + + @TestMetadata("typeOfCapturedStar.kt") + public void testTypeOfCapturedStar() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/typeOfCapturedStar.kt"); + } + + @TestMetadata("typeOfReifiedUnit.kt") + public void testTypeOfReifiedUnit() throws Exception { + runTest("compiler/testData/codegen/box/reflection/typeOf/js/typeOfReifiedUnit.kt"); + } } @TestMetadata("compiler/testData/codegen/box/reflection/typeOf/noReflect")