Fix navigation on values()/valueOf() of enum classes
This commit is contained in:
@@ -86,7 +86,7 @@ public class DescriptorFactory {
|
||||
public static SimpleFunctionDescriptor createEnumValuesMethod(@NotNull ClassDescriptor enumClass) {
|
||||
SimpleFunctionDescriptorImpl values =
|
||||
SimpleFunctionDescriptorImpl.create(enumClass, Annotations.EMPTY, DescriptorUtils.ENUM_VALUES,
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE);
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, enumClass.getSource());
|
||||
return values.initialize(null, NO_RECEIVER_PARAMETER, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
Collections.<ValueParameterDescriptor>emptyList(),
|
||||
KotlinBuiltIns.getInstance().getArrayType(enumClass.getDefaultType()), Modality.FINAL,
|
||||
@@ -97,10 +97,10 @@ public class DescriptorFactory {
|
||||
public static SimpleFunctionDescriptor createEnumValueOfMethod(@NotNull ClassDescriptor enumClass) {
|
||||
SimpleFunctionDescriptorImpl valueOf =
|
||||
SimpleFunctionDescriptorImpl.create(enumClass, Annotations.EMPTY, DescriptorUtils.ENUM_VALUE_OF,
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE);
|
||||
CallableMemberDescriptor.Kind.SYNTHESIZED, enumClass.getSource());
|
||||
ValueParameterDescriptor parameterDescriptor = new ValueParameterDescriptorImpl(
|
||||
valueOf, null, 0, Annotations.EMPTY, Name.identifier("value"), KotlinBuiltIns.getInstance().getStringType(), false, null,
|
||||
SourceElement.NO_SOURCE
|
||||
enumClass.getSource()
|
||||
);
|
||||
return valueOf.initialize(null, NO_RECEIVER_PARAMETER, Collections.<TypeParameterDescriptor>emptyList(),
|
||||
Collections.singletonList(parameterDescriptor), enumClass.getDefaultType(), Modality.FINAL,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
enum class E {
|
||||
LOL
|
||||
}
|
||||
|
||||
val values = E.val<caret>ues()
|
||||
|
||||
// REF: (test).E
|
||||
@@ -0,0 +1,5 @@
|
||||
import java.lang.annotation.RetentionPolicy
|
||||
|
||||
val values = RetentionPolicy.val<caret>ueOf("")
|
||||
|
||||
// REF: (java.lang.annotation).RetentionPolicy
|
||||
@@ -87,6 +87,12 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("EnumValues.kt")
|
||||
public void testEnumValues() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/EnumValues.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("FakeJavaLang1.kt")
|
||||
public void testFakeJavaLang1() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/FakeJavaLang1.kt");
|
||||
@@ -171,6 +177,12 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaEnumValueOf.kt")
|
||||
public void testJavaEnumValueOf() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/JavaEnumValueOf.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("JavaParameter.kt")
|
||||
public void testJavaParameter() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("idea/testData/resolve/references/JavaParameter.kt");
|
||||
|
||||
Reference in New Issue
Block a user