Use type from compile time value for prefix expression
This commit is contained in:
+10
@@ -281,4 +281,14 @@ public abstract class AbstractAnnotationDescriptorResolveTest extends JetLiteFix
|
||||
}, " ");
|
||||
assertEquals("Failed to resolve annotation descriptor for " + member.toString(), expectedAnnotation, actual);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static String getAnnotations(DeclarationDescriptor member) {
|
||||
return StringUtil.join(member.getAnnotations(), new Function<AnnotationDescriptor, String>() {
|
||||
@Override
|
||||
public String fun(AnnotationDescriptor annotationDescriptor) {
|
||||
return annotationDescriptor.getType().toString() + DescriptorUtils.getSortedValueArguments(annotationDescriptor, DescriptorRenderer.TEXT);
|
||||
}
|
||||
}, " ");
|
||||
}
|
||||
}
|
||||
|
||||
+4
-1
@@ -19,6 +19,7 @@ package org.jetbrains.jet.resolve.annotation
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.jet.InTextDirectivesUtils
|
||||
import java.io.File
|
||||
import org.jetbrains.jet.JetTestUtils
|
||||
|
||||
public abstract class AbstractAnnotationParameterTest : AbstractAnnotationDescriptorResolveTest() {
|
||||
fun doTest(path: String) {
|
||||
@@ -27,6 +28,8 @@ public abstract class AbstractAnnotationParameterTest : AbstractAnnotationDescri
|
||||
val classDescriptor = AbstractAnnotationDescriptorResolveTest.getClassDescriptor(namespaceDescriptor, "MyClass")
|
||||
|
||||
val expected = InTextDirectivesUtils.findListWithPrefixes(fileText, "// EXPECTED: ").makeString(", ")
|
||||
AbstractAnnotationDescriptorResolveTest.checkDescriptor(expected, classDescriptor)
|
||||
val actual = AbstractAnnotationDescriptorResolveTest.getAnnotations(classDescriptor)
|
||||
|
||||
JetTestUtils.assertEqualsToFile(File(path), fileText.replace(expected, actual))
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ import java.io.IOException;
|
||||
public class AnnotationDescriptorResolveTest extends AbstractAnnotationDescriptorResolveTest {
|
||||
public void testIntAnnotation() throws IOException {
|
||||
String content = getContent("AnnInt(1)");
|
||||
String expectedAnnotation = "AnnInt[a = 1.toInt(): jet.Int]";
|
||||
String expectedAnnotation = "AnnInt[a = IntegerValueType(1): IntegerValueType(1)]";
|
||||
doTest(content, expectedAnnotation);
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ public class AnnotationDescriptorResolveTest extends AbstractAnnotationDescripto
|
||||
|
||||
public void testIntArrayAnnotation() throws IOException {
|
||||
String content = getContent("AnnIntArray(intArray(1, 2))");
|
||||
String expectedAnnotation = "AnnIntArray[a = [1.toInt(), 2.toInt()]: jet.IntArray]";
|
||||
String expectedAnnotation = "AnnIntArray[a = [IntegerValueType(1), IntegerValueType(2)]: jet.IntArray]";
|
||||
doTest(content, expectedAnnotation);
|
||||
}
|
||||
|
||||
public void testIntArrayVarargAnnotation() throws IOException {
|
||||
String content = getContent("AnnIntVararg(1, 2)");
|
||||
String expectedAnnotation = "AnnIntVararg[a = [1.toInt(), 2.toInt()]: jet.IntArray]";
|
||||
String expectedAnnotation = "AnnIntVararg[a = [IntegerValueType(1), IntegerValueType(2)]: jet.IntArray]";
|
||||
doTest(content, expectedAnnotation);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class AnnotationDescriptorResolveTest extends AbstractAnnotationDescripto
|
||||
|
||||
public void testAnnotationAnnotation() throws Exception {
|
||||
String content = getContent("AnnAnn(AnnInt(1))");
|
||||
String expectedAnnotation = "AnnAnn[a = AnnInt[a = 1.toInt()]: test.AnnInt]";
|
||||
String expectedAnnotation = "AnnAnn[a = AnnInt[a = IntegerValueType(1)]: test.AnnInt]";
|
||||
doTest(content, expectedAnnotation);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user