KT-59732 [FIR] Add testdata to check incorrect imports with test compiler plugins

This commit is contained in:
Roman Golyshev
2023-12-03 12:50:09 +01:00
committed by Space Team
parent 99c7fab401
commit 776926518d
3 changed files with 79 additions and 0 deletions
@@ -0,0 +1,36 @@
FILE: test_NestedClassAndMaterializeMember.kt
package test
@R|org/jetbrains/kotlin/fir/plugin/NestedClassAndMaterializeMember|() public final class MyClassWithNested : R|kotlin/Any| {
public constructor(): R|test/MyClassWithNested| {
super<R|kotlin/Any|>()
}
public final fun materialize(): R|test/MyClassWithNested|
public final class Nested : R|kotlin/Any| {
public constructor(): R|test/MyClassWithNested.Nested| {
super<R|kotlin/Any|>()
}
}
}
FILE: test_CompanionWithFoo.kt
package test
@R|org/jetbrains/kotlin/fir/plugin/CompanionWithFoo|() public final class MyClassWithCompanion : R|kotlin/Any| {
public constructor(): R|test/MyClassWithCompanion| {
super<R|kotlin/Any|>()
}
public final companion object Companion : R|kotlin/Any| {
public final fun foo(): R|kotlin/Int|
private constructor(): R|test/MyClassWithCompanion.Companion| {
super<R|kotlin/Any|>()
}
}
}
@@ -0,0 +1,37 @@
// FILE: test_NestedClassAndMaterializeMember.kt
package test
import org.jetbrains.kotlin.fir.plugin.NestedClassAndMaterializeMember
import test.MyClassWithNested.*
import test.MyClassWithNested.Nested
import test.MyClassWithNested.Nested.*
// does not exist
import test.MyClassWithNested.<!UNRESOLVED_IMPORT!>FakeNested<!>
import test.MyClassWithNested.<!UNRESOLVED_IMPORT!>FakeNested<!>.*
// cannot import member
import test.MyClassWithNested.<!CANNOT_BE_IMPORTED!>materialize<!>
@NestedClassAndMaterializeMember
class MyClassWithNested
// FILE: test_CompanionWithFoo.kt
package test
import org.jetbrains.kotlin.fir.plugin.CompanionWithFoo
import test.MyClassWithCompanion.*
import test.MyClassWithCompanion.Companion
import test.MyClassWithCompanion.Companion.foo
// cannot star import from companion
import test.MyClassWithCompanion.<!CANNOT_ALL_UNDER_IMPORT_FROM_SINGLETON!>Companion<!>.*
@CompanionWithFoo
class MyClassWithCompanion
@@ -39,6 +39,12 @@ public class FirPsiPluginDiagnosticTestGenerated extends AbstractFirPsiPluginDia
runTest("plugins/fir-plugin-prototype/testData/diagnostics/checkers/dependencyWithoutAttributePlugin.kt");
}
@Test
@TestMetadata("importsWithGeneratedDeclarations.kt")
public void testImportsWithGeneratedDeclarations() throws Exception {
runTest("plugins/fir-plugin-prototype/testData/diagnostics/checkers/importsWithGeneratedDeclarations.kt");
}
@Test
@TestMetadata("mixingComposableAndNormalFunctions.kt")
public void testMixingComposableAndNormalFunctions() throws Exception {