From bffbbe6293230f83a9b9bff58a7aadeb7903b8fd Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Fri, 27 Oct 2023 12:11:21 +0200 Subject: [PATCH] [LL FIR] add LL FIR tests based on `AbstractFirPsiNativeDiagnosticsTest` ^KT-62910 fixed --- .../low-level-api-fir-native/build.gradle.kts | 38 ++++++ .../based/LLFirNativeTestGenerated.java | 112 ++++++++++++++++++ .../LLFirReversedNativeTestGenerated.java | 112 ++++++++++++++++++ .../AbstractCompilerBasedNativeTestForFir.kt | 47 ++++++++ .../nativeTests/cloneableInNative.ll.kt | 9 ++ .../nativeTests/forwardDeclarations.ll.kt | 109 +++++++++++++++++ .../diagnostics/nativeTests/identifiers.kt | 1 + .../generator-kotlin-native/build.gradle.kts | 4 + .../konan/GenerateAnalysisApiNativeTests.kt | 3 + .../analysis/api/konan/firNativeLowLevel.kt | 29 +++++ settings.gradle | 3 +- 11 files changed, 466 insertions(+), 1 deletion(-) create mode 100644 analysis/low-level-api-fir/low-level-api-fir-native/build.gradle.kts create mode 100644 analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java create mode 100644 analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java create mode 100644 analysis/low-level-api-fir/low-level-api-fir-native/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/AbstractCompilerBasedNativeTestForFir.kt create mode 100644 compiler/testData/diagnostics/nativeTests/cloneableInNative.ll.kt create mode 100644 compiler/testData/diagnostics/nativeTests/forwardDeclarations.ll.kt create mode 100644 generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/firNativeLowLevel.kt diff --git a/analysis/low-level-api-fir/low-level-api-fir-native/build.gradle.kts b/analysis/low-level-api-fir/low-level-api-fir-native/build.gradle.kts new file mode 100644 index 00000000000..4fbdc7942b7 --- /dev/null +++ b/analysis/low-level-api-fir/low-level-api-fir-native/build.gradle.kts @@ -0,0 +1,38 @@ +plugins { + kotlin("jvm") + id("jps-compatible") +} + +dependencies { + testImplementation(project(":analysis:low-level-api-fir")) + testImplementation(project(":analysis:analysis-api-standalone:analysis-api-fir-standalone-base")) + testImplementation(projectTests(":compiler:tests-common")) + testImplementation(projectTests(":analysis:analysis-api-impl-barebone")) + testImplementation(projectTests(":analysis:analysis-test-framework")) + testImplementation(projectTests(":analysis:analysis-api-impl-base")) + testImplementation(projectTests(":analysis:low-level-api-fir")) + testImplementation(projectTests(":native:native.tests")) + + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter.api) + testRuntimeOnly(libs.junit.jupiter.engine) +} + +sourceSets { + "main" { none() } + "test" { + projectDefault() + generatedTestDir() + } +} + + +projectTest(jUnitMode = JUnitMode.JUnit5) { + dependsOn(":dist") + workingDir = rootDir + useJUnitPlatform() +} + +nativeTest("llFirNativeTests", "llFirNative") + +testsJar() diff --git a/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java new file mode 100644 index 00000000000..727ac937e87 --- /dev/null +++ b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirNativeTestGenerated.java @@ -0,0 +1,112 @@ +/* + * Copyright 2010-2023 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. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.junit.jupiter.api.Tag; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.konan.GenerateAnalysisApiNativeTestsKt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/diagnostics/nativeTests") +@TestDataPath("$PROJECT_ROOT") +@Tag("llFirNative") +public class LLFirNativeTestGenerated extends AbstractLLFirNativeTest { + @Test + public void testAllFilesPresentInNativeTests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); + } + + @Test + @TestMetadata("arrays_after.kt") + public void testArrays_after() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/arrays_after.kt"); + } + + @Test + @TestMetadata("cloneableInNative.kt") + public void testCloneableInNative() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt"); + } + + @Test + @TestMetadata("forwardDeclarations.kt") + public void testForwardDeclarations() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/forwardDeclarations.kt"); + } + + @Test + @TestMetadata("identifiers.kt") + public void testIdentifiers() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt"); + } + + @Test + @TestMetadata("isInitialized.kt") + public void testIsInitialized() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt"); + } + + @Test + @TestMetadata("isInitializedError.kt") + public void testIsInitializedError() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt"); + } + + @Test + @TestMetadata("nativeProtectedFunCall.kt") + public void testNativeProtectedFunCall() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt"); + } + + @Test + @TestMetadata("objCName.kt") + public void testObjCName() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/objCName.kt"); + } + + @Test + @TestMetadata("objCRefinement.kt") + public void testObjCRefinement() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt"); + } + + @Test + @TestMetadata("sharedImmutable.kt") + public void testSharedImmutable() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt"); + } + + @Test + @TestMetadata("threadLocal.kt") + public void testThreadLocal() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt"); + } + + @Test + @TestMetadata("throws.kt") + public void testThrows() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/throws.kt"); + } + + @Test + @TestMetadata("throwsClash.kt") + public void testThrowsClash() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt"); + } + + @Test + @TestMetadata("topLevelSingleton.kt") + public void testTopLevelSingleton() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt"); + } +} diff --git a/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java new file mode 100644 index 00000000000..09276e621a6 --- /dev/null +++ b/analysis/low-level-api-fir/low-level-api-fir-native/tests-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/LLFirReversedNativeTestGenerated.java @@ -0,0 +1,112 @@ +/* + * Copyright 2010-2023 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. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.junit.jupiter.api.Tag; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.analysis.api.konan.GenerateAnalysisApiNativeTestsKt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/diagnostics/nativeTests") +@TestDataPath("$PROJECT_ROOT") +@Tag("llFirNative") +public class LLFirReversedNativeTestGenerated extends AbstractLLFirReversedNativeTest { + @Test + public void testAllFilesPresentInNativeTests() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/nativeTests"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true); + } + + @Test + @TestMetadata("arrays_after.kt") + public void testArrays_after() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/arrays_after.kt"); + } + + @Test + @TestMetadata("cloneableInNative.kt") + public void testCloneableInNative() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/cloneableInNative.kt"); + } + + @Test + @TestMetadata("forwardDeclarations.kt") + public void testForwardDeclarations() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/forwardDeclarations.kt"); + } + + @Test + @TestMetadata("identifiers.kt") + public void testIdentifiers() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/identifiers.kt"); + } + + @Test + @TestMetadata("isInitialized.kt") + public void testIsInitialized() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/isInitialized.kt"); + } + + @Test + @TestMetadata("isInitializedError.kt") + public void testIsInitializedError() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/isInitializedError.kt"); + } + + @Test + @TestMetadata("nativeProtectedFunCall.kt") + public void testNativeProtectedFunCall() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/nativeProtectedFunCall.kt"); + } + + @Test + @TestMetadata("objCName.kt") + public void testObjCName() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/objCName.kt"); + } + + @Test + @TestMetadata("objCRefinement.kt") + public void testObjCRefinement() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt"); + } + + @Test + @TestMetadata("sharedImmutable.kt") + public void testSharedImmutable() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/sharedImmutable.kt"); + } + + @Test + @TestMetadata("threadLocal.kt") + public void testThreadLocal() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/threadLocal.kt"); + } + + @Test + @TestMetadata("throws.kt") + public void testThrows() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/throws.kt"); + } + + @Test + @TestMetadata("throwsClash.kt") + public void testThrowsClash() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/throwsClash.kt"); + } + + @Test + @TestMetadata("topLevelSingleton.kt") + public void testTopLevelSingleton() throws Exception { + runTest("compiler/testData/diagnostics/nativeTests/topLevelSingleton.kt"); + } +} diff --git a/analysis/low-level-api-fir/low-level-api-fir-native/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/AbstractCompilerBasedNativeTestForFir.kt b/analysis/low-level-api-fir/low-level-api-fir-native/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/AbstractCompilerBasedNativeTestForFir.kt new file mode 100644 index 00000000000..3cda05224cc --- /dev/null +++ b/analysis/low-level-api-fir/low-level-api-fir-native/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/konan/compiler/based/AbstractCompilerBasedNativeTestForFir.kt @@ -0,0 +1,47 @@ +/* + * Copyright 2010-2023 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. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based + +import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirOnlyNonReversedTestSuppressor +import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirOnlyReversedTestSuppressor +import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.AbstractCompilerBasedTestForFir +import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.ReversedFirIdenticalChecker +import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.facades.LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder +import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.facades.LLFirAnalyzerFacadeFactoryWithoutPreresolve +import org.jetbrains.kotlin.konan.test.diagnostics.baseFirNativeDiagnosticTestConfiguration +import org.jetbrains.kotlin.konan.test.diagnostics.baseNativeDiagnosticTestConfiguration +import org.jetbrains.kotlin.platform.konan.NativePlatforms +import org.jetbrains.kotlin.test.bind +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.runners.configurationForClassicAndFirTestsAlongside + +abstract class AbstractLLFirNativeTestBase : AbstractCompilerBasedTestForFir() { + + protected fun TestConfigurationBuilder.baseConfiguration() { + globalDefaults { + targetPlatform = NativePlatforms.unspecifiedNativePlatform + } + baseFirNativeDiagnosticTestConfiguration() + configurationForClassicAndFirTestsAlongside(::ReversedFirIdenticalChecker) + } +} + + +abstract class AbstractLLFirNativeTest : AbstractLLFirNativeTestBase() { + override fun TestConfigurationBuilder.configureTest() { + baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve)) + baseConfiguration() + useAfterAnalysisCheckers(::LLFirOnlyNonReversedTestSuppressor) + } +} + +abstract class AbstractLLFirReversedNativeTest : AbstractLLFirNativeTestBase() { + override fun TestConfigurationBuilder.configureTest() { + baseNativeDiagnosticTestConfiguration(::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithPreresolveInReversedOrder)) + baseConfiguration() + useAfterAnalysisCheckers(::LLFirOnlyReversedTestSuppressor) + } +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/nativeTests/cloneableInNative.ll.kt b/compiler/testData/diagnostics/nativeTests/cloneableInNative.ll.kt new file mode 100644 index 00000000000..dd5aff976c4 --- /dev/null +++ b/compiler/testData/diagnostics/nativeTests/cloneableInNative.ll.kt @@ -0,0 +1,9 @@ +// LL_FIR_DIVERGENCE +// KT-62935 +// LL_FIR_DIVERGENCE +// ISSUE: KT-58549 + +fun main() { + val x: kotlin.Cloneable = if (true) intArrayOf(1) else longArrayOf(1) + x +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/nativeTests/forwardDeclarations.ll.kt b/compiler/testData/diagnostics/nativeTests/forwardDeclarations.ll.kt new file mode 100644 index 00000000000..1162695eb4a --- /dev/null +++ b/compiler/testData/diagnostics/nativeTests/forwardDeclarations.ll.kt @@ -0,0 +1,109 @@ +// LL_FIR_DIVERGENCE +// KT-62936 +// LL_FIR_DIVERGENCE +// WITH_STDLIB + +// FILE: stdlib.kt + +package kotlinx.cinterop + +abstract class CStructVar +interface ObjCObject +abstract class ObjCObjectBase : ObjCObject + +// FILE: cnames.kt + +package cnames.structs + +class FwdStruct {} + +// FILE: objcnamesClasses.kt + +package objcnames.classes + +class FwdObjcClass {} + +// FILE: objcnamesProtocols.kt + +package objcnames.protocols + +interface FwdProtocol {} + +// FILE: lib.kt + +package lib + +import kotlinx.cinterop.* + +class FwdStruct : CStructVar() +class FwdObjcClass : ObjCObjectBase() +interface FwdProtocol : ObjCObject + +// FILE: lib2.kt + +package lib2 + +class FwdStruct +class FwdObjcClass +interface FwdProtocol + + +// FILE: main.kt + +// this inspections differs in K1/K2, but unrelated to what is tested in this test +@file:Suppress("UNUSED_PARAMETER", "UNUSED_EXPRESSION", "UNUSED_VARIABLE", "INCOMPATIBLE_TYPES") + +fun testUnckeckedAsFromAny(x: Any) { + x as? cnames.structs.FwdStruct + x as? objcnames.classes.FwdObjcClass + x as? objcnames.protocols.FwdProtocol + if (1 > 0) { x as cnames.structs.FwdStruct } + if (1 > 0) { x as objcnames.classes.FwdObjcClass } + if (1 > 0) { x as objcnames.protocols.FwdProtocol } +} + +fun testIs(x: Any) : Int { + return when { + x is cnames.structs.FwdStruct -> 1 + x is objcnames.classes.FwdObjcClass -> 2 + x is objcnames.protocols.FwdProtocol -> 3 + else -> 4 + } +} + +fun testIs2(x: lib.FwdStruct) = x is cnames.structs.FwdStruct +fun testIs3(x: lib.FwdObjcClass) = x is objcnames.classes.FwdObjcClass +fun testIs4(x: lib.FwdProtocol) = x is objcnames.protocols.FwdProtocol + + +fun testClass1(x : cnames.structs.FwdStruct) = x::class +fun testClass2(x : objcnames.classes.FwdObjcClass) = x::class +fun testClass3(x : objcnames.protocols.FwdProtocol) = x::class +fun testClass4() { + cnames.structs.FwdStruct::class + objcnames.classes.FwdObjcClass::class + objcnames.protocols.FwdProtocol::class +} +inline fun inlineF(x: T) {} + +fun testInline1(x : cnames.structs.FwdStruct) = inlineF(x) +fun testInline2(x : objcnames.classes.FwdObjcClass) = inlineF(x) +fun testInline3(x : objcnames.protocols.FwdProtocol) = inlineF(x) +fun testInline4() { + val a : (cnames.structs.FwdStruct) -> Unit = ::inlineF + val b : (objcnames.classes.FwdObjcClass) -> Unit = ::inlineF + val c : (objcnames.protocols.FwdProtocol) -> Unit = ::inlineF +} + +fun testCheckedAs1(x : lib.FwdStruct) = x as cnames.structs.FwdStruct +fun testCheckedAs2(x : lib.FwdObjcClass) = x as objcnames.classes.FwdObjcClass +fun testCheckedAs3(x : lib.FwdProtocol) = x as objcnames.protocols.FwdProtocol +fun testCheckedSafeAs4(x : lib.FwdStruct) = x as? cnames.structs.FwdStruct +fun testCheckedSafeAs5(x : lib.FwdObjcClass) = x as? objcnames.classes.FwdObjcClass +fun testCheckedSafeAs6(x : lib.FwdProtocol) = x as? objcnames.protocols.FwdProtocol + +fun testUnCheckedAs1(x : lib2.FwdStruct) = x as cnames.structs.FwdStruct +fun testUnCheckedAs2(x : lib2.FwdObjcClass) = x as objcnames.classes.FwdObjcClass +fun testUnCheckedAs3(x : lib2.FwdProtocol) = x as objcnames.protocols.FwdProtocol + +fun testUnCheckedAs4(x : lib.FwdStruct) = x as objcnames.classes.FwdObjcClass diff --git a/compiler/testData/diagnostics/nativeTests/identifiers.kt b/compiler/testData/diagnostics/nativeTests/identifiers.kt index f447b60f133..7f0e1d74d23 100644 --- a/compiler/testData/diagnostics/nativeTests/identifiers.kt +++ b/compiler/testData/diagnostics/nativeTests/identifiers.kt @@ -1,3 +1,4 @@ +// IGNORE_NON_REVERSED_RESOLVE: KT-62937 // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -MISSING_DEPENDENCY_SUPERCLASS diff --git a/generators/analysis-api-generator/generator-kotlin-native/build.gradle.kts b/generators/analysis-api-generator/generator-kotlin-native/build.gradle.kts index d5fc27f3b0b..c7a5a4467f2 100644 --- a/generators/analysis-api-generator/generator-kotlin-native/build.gradle.kts +++ b/generators/analysis-api-generator/generator-kotlin-native/build.gradle.kts @@ -16,6 +16,10 @@ dependencies { testImplementation(projectTests(":compiler:tests-spec")) testImplementation(projectTests(":generators:analysis-api-generator")) + testImplementation(projectTests(":analysis:low-level-api-fir")) + testImplementation(projectTests(":analysis:analysis-api-impl-barebone")) + testImplementation(projectTests(":analysis:low-level-api-fir:low-level-api-fir-native")) + testImplementation(intellijCore()) testApi(platform(libs.junit.bom)) testImplementation(libs.junit.jupiter.api) diff --git a/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/GenerateAnalysisApiNativeTests.kt b/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/GenerateAnalysisApiNativeTests.kt index a76b82aa40e..0305776ab46 100644 --- a/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/GenerateAnalysisApiNativeTests.kt +++ b/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/GenerateAnalysisApiNativeTests.kt @@ -16,4 +16,7 @@ fun main(args: Array) { } private fun AnalysisApiTestGroup.generateTests() { + suiteBasedTests { + generateFirNativeLowLevelTests() + } } diff --git a/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/firNativeLowLevel.kt b/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/firNativeLowLevel.kt new file mode 100644 index 00000000000..2725538571a --- /dev/null +++ b/generators/analysis-api-generator/generator-kotlin-native/tests/org/jetbrains/kotlin/generators/tests/analysis/api/konan/firNativeLowLevel.kt @@ -0,0 +1,29 @@ +/* + * Copyright 2010-2023 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. + */ + +package org.jetbrains.kotlin.generators.tests.analysis.api.konan + +import org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based.AbstractLLFirNativeTest +import org.jetbrains.kotlin.analysis.low.level.api.fir.konan.compiler.based.AbstractLLFirReversedNativeTest +import org.jetbrains.kotlin.generators.TestGroupSuite +import org.jetbrains.kotlin.generators.model.annotation +import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN +import org.junit.jupiter.api.Tag + +internal fun TestGroupSuite.generateFirNativeLowLevelTests() { + testGroup("analysis/low-level-api-fir/low-level-api-fir-native/tests-gen", "compiler/testData/diagnostics") { + testClass( + annotations = listOf(annotation(Tag::class.java, "llFirNative")) + ) { + model("nativeTests", testMethod = "doTest", excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN) + } + + testClass( + annotations = listOf(annotation(Tag::class.java, "llFirNative")) + ) { + model("nativeTests", testMethod = "doTest", excludedPattern = CUSTOM_TEST_DATA_EXTENSION_PATTERN) + } + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index d51f0c89209..0841147f6c2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -578,7 +578,8 @@ include ":generators:analysis-api-generator", ":tools:ide-plugin-dependencies-validator" if (buildProperties.isKotlinNativeEnabled) { - include ":generators:analysis-api-generator:generator-kotlin-native" + include ":generators:analysis-api-generator:generator-kotlin-native", + ":analysis:low-level-api-fir:low-level-api-fir-native" }