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:
Alexander Udalov
2012-09-27 16:07:45 +04:00
parent acf8702ccf
commit 38a42bdb79
3 changed files with 17 additions and 6 deletions
@@ -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());
}
}
+3
View File
@@ -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");