[FIR] Visit class annotations without the class's scope
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
// FILE: State.java
|
||||
|
||||
package simulation
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface State {
|
||||
@NotNull @NonNls
|
||||
String name();
|
||||
String @NotNull [] storages() default {};
|
||||
}
|
||||
|
||||
// FILE: KotlinImporterComponent.kt
|
||||
|
||||
package simulation
|
||||
|
||||
// KotlinMavenImporter.kt:407:1
|
||||
@State(
|
||||
name = "AutoImportedSourceRoots"
|
||||
)
|
||||
class KotlinImporterComponent {
|
||||
class State(var directories: List<String> = ArrayList())
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
FILE: KotlinImporterComponent.kt
|
||||
@R|State|(name = String(AutoImportedSourceRoots)) public final class KotlinImporterComponent : R|kotlin/Any| {
|
||||
public constructor(): R|simulation/KotlinImporterComponent| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final class State : R|kotlin/Any| {
|
||||
public constructor(directories: R|kotlin/collections/List<kotlin/String>| = R|java/util/ArrayList.ArrayList|<R|ft<kotlin/String, kotlin/String?>!|>()): R|simulation/KotlinImporterComponent.State| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final var directories: R|kotlin/collections/List<kotlin/String>| = R|<local>/directories|
|
||||
public get(): R|kotlin/collections/List<kotlin/String>|
|
||||
public set(value: R|kotlin/collections/List<kotlin/String>|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Generated
+5
@@ -1081,6 +1081,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedWithoutPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("testIllegalAnnotationClass.kt")
|
||||
public void testTestIllegalAnnotationClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/testIllegalAnnotationClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsNotAllowed.kt")
|
||||
public void testTypeArgumentsNotAllowed() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt");
|
||||
|
||||
+5
@@ -1081,6 +1081,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/supertypeInitializedWithoutPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("testIllegalAnnotationClass.kt")
|
||||
public void testTestIllegalAnnotationClass() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/testIllegalAnnotationClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeArgumentsNotAllowed.kt")
|
||||
public void testTypeArgumentsNotAllowed() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/diagnostics/typeArgumentsNotAllowed.kt");
|
||||
|
||||
+7
@@ -52,6 +52,11 @@ abstract class FirAbstractTreeTransformerWithSuperTypes(
|
||||
data: Nothing?
|
||||
): CompositeTransformResult<FirStatement> {
|
||||
return withScopeCleanup {
|
||||
// Otherwise annotations may try to resolve
|
||||
// themselves as inner classes of the `firClass`
|
||||
// if their names match
|
||||
firClass.transformAnnotations(this, null)
|
||||
|
||||
// ? Is it Ok to use original file session here ?
|
||||
val superTypes = lookupSuperTypes(
|
||||
firClass,
|
||||
@@ -76,6 +81,8 @@ abstract class FirAbstractTreeTransformerWithSuperTypes(
|
||||
|
||||
nestedClassifierScope(firClass)?.let(scopes::add)
|
||||
|
||||
// Note that annotations are still visited here
|
||||
// again, although there's no need in it
|
||||
transformElement(firClass, data)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user