Do not wrap built-in function in JetLightClass (EA-38770)
Built-in top-level functions are located in jet.namespace class. JetStandardClasses.isStandardClass() now checks that a given fqName starts with "jet.", instead of searching it in the standard scope, to prevent this kind of errors in the future
This commit is contained in:
@@ -613,11 +613,6 @@ public class JetStandardClasses {
|
||||
}
|
||||
|
||||
public static boolean isStandardClass(@NotNull FqName fqName) {
|
||||
for (DeclarationDescriptor descriptor : getAllStandardClasses()) {
|
||||
if (DescriptorUtils.getFQName(descriptor).equals(fqName.toUnsafe())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return JetStandardClasses.STANDARD_CLASSES_FQNAME.equals(fqName.parent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
fun <T> foo() {
|
||||
T.<caret>toString()
|
||||
}
|
||||
@@ -87,6 +87,19 @@ public class JetJavaFacadeTest extends LightCodeInsightFixtureTestCase {
|
||||
doTestWrapClass();
|
||||
}
|
||||
|
||||
public void testEa38770() {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
|
||||
PsiReference reference = myFixture.getFile().findReferenceAt(myFixture.getCaretOffset());
|
||||
assertNotNull(reference);
|
||||
PsiElement element = reference.resolve();
|
||||
assertNotNull(element);
|
||||
assertInstanceOf(element, JetNamedFunction.class);
|
||||
JetNamedFunction toString = (JetNamedFunction) element;
|
||||
|
||||
assertNull("There should be no wrapper for built-in function", JetLightClass.wrapMethod(toString));
|
||||
}
|
||||
|
||||
public void testInnerClass() throws Exception {
|
||||
myFixture.configureByFile(getTestName(true) + ".kt");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user