Frontend: added the support file annotations to LazyTopDownAnalyzer.
This commit is contained in:
@@ -28,6 +28,7 @@ import org.jetbrains.jet.di.InjectorForBodyResolve;
|
||||
import org.jetbrains.jet.lang.cfg.JetFlowInformationProvider;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.calls.autocasts.DataFlowInfo;
|
||||
@@ -231,16 +232,23 @@ public class ElementResolver {
|
||||
}
|
||||
|
||||
private static void annotationAdditionalResolve(ResolveSession resolveSession, JetAnnotationEntry jetAnnotationEntry) {
|
||||
Annotations annotations = null;
|
||||
|
||||
JetDeclaration declaration = PsiTreeUtil.getParentOfType(jetAnnotationEntry, JetDeclaration.class);
|
||||
if (declaration != null) {
|
||||
Annotated descriptor = resolveSession.resolveToDescriptor(declaration);
|
||||
annotations = descriptor.getAnnotations();
|
||||
}
|
||||
else {
|
||||
JetFileAnnotationList fileAnnotationList = PsiTreeUtil.getParentOfType(jetAnnotationEntry, JetFileAnnotationList.class);
|
||||
if (fileAnnotationList != null) {
|
||||
annotations = resolveSession.getFileAnnotations(fileAnnotationList.getContainingJetFile());
|
||||
}
|
||||
}
|
||||
|
||||
AnnotationResolver.resolveAnnotationsArguments(
|
||||
descriptor,
|
||||
resolveSession.getTrace()
|
||||
);
|
||||
|
||||
ForceResolveUtil.forceResolveAllContents(descriptor.getAnnotations());
|
||||
if (annotations != null) {
|
||||
AnnotationResolver.resolveAnnotationsArguments(annotations, resolveSession.getTrace());
|
||||
ForceResolveUtil.forceResolveAllContents(annotations);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
[file: kotlin.deprecated("message")]
|
||||
[file: suppress(<error>BAR</error>)]
|
||||
[file: suppress(BAZ)]
|
||||
|
||||
[<error>k</error>otlin.deprecated("message")]
|
||||
[<error>s</error>uppress(<error>BAR</error>)]
|
||||
[<error>s</error>uppress(BAZ)]
|
||||
|
||||
[file: myAnnotation(1, "string")]
|
||||
[file: boo.myAnnotation(1, <error>BAR</error>)]
|
||||
[file: myAnnotation(N, BAZ)]
|
||||
|
||||
[<error>m</error>yAnnotation(1, "string")]
|
||||
[<error>b</error>oo.myAnnotation(1, "string")]
|
||||
[<error>m</error>yAnnotation(N, BAZ)]
|
||||
|
||||
package boo
|
||||
|
||||
val BAZ = "baz"
|
||||
val N = 0
|
||||
|
||||
annotation class myAnnotation(val i: Int, val s: String)
|
||||
@@ -0,0 +1,5 @@
|
||||
[file: kotlin.<caret>deprecated("message")]
|
||||
|
||||
package foo
|
||||
|
||||
// REF: (kotlin).deprecated
|
||||
@@ -0,0 +1,7 @@
|
||||
[file: <caret>D("message")]
|
||||
|
||||
package foo
|
||||
|
||||
import kotlin.deprecated as D
|
||||
|
||||
// REF: (kotlin).deprecated
|
||||
@@ -47,6 +47,12 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/checker"), Pattern.compile("^(.+)\\.kt$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/AnnotationOnFile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AnonymousInitializers.kt")
|
||||
public void testAnonymousInitializers() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/AnonymousInitializers.kt");
|
||||
|
||||
@@ -51,6 +51,18 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/AnnotationOnFile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationOnFileWithImport.kt")
|
||||
public void testAnnotationOnFileWithImport() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/AnnotationOnFileWithImport.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("AnnotationParameter.kt")
|
||||
public void testAnnotationParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/AnnotationParameter.kt");
|
||||
|
||||
Reference in New Issue
Block a user