better root ns
* ModuleDescrpiptor now lives in context * ns parent is module descriptor iff ns is root ns * minor test enhancements
This commit is contained in:
@@ -19,9 +19,12 @@ package org.jetbrains.jet.plugin;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
@@ -35,17 +38,9 @@ import java.util.LinkedList;
|
||||
*/
|
||||
public class JetPluginUtil {
|
||||
@NotNull
|
||||
public static String computeTypeFullName(JetType type) {
|
||||
LinkedList<String> fullName = computeTypeFullNameList(type);
|
||||
String last = fullName.getLast();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String s : fullName) {
|
||||
sb.append(s);
|
||||
if (s != last) {
|
||||
sb.append('.');
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
public static FqName computeTypeFullName(@NotNull JetType type) {
|
||||
ClassDescriptor clazz = (ClassDescriptor) type.getConstructor().getDeclarationDescriptor();
|
||||
return DescriptorUtils.getFQName(clazz);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ImportClassHelper {
|
||||
if (element != null && element.getContainingFile() == file) { //declaration is in the same file, so no import is needed
|
||||
return;
|
||||
}
|
||||
addImportDirective(JetPluginUtil.computeTypeFullName(type), file);
|
||||
addImportDirective(JetPluginUtil.computeTypeFullName(type).getFqName(), file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -85,8 +85,8 @@ public class JetPsiCheckerMultifileTest extends JetQuickFixMultiFileTest {
|
||||
}
|
||||
});
|
||||
|
||||
assertTrue("No main file for test", mainFiles.size() > 0);
|
||||
assertTrue("Too many main files for the test", mainFiles.size() <= 1);
|
||||
assertTrue("No main file for test in " + dir, mainFiles.size() > 0);
|
||||
assertTrue("Too many main files for the test in " + dir, mainFiles.size() <= 1);
|
||||
|
||||
final Collection<File> dataFiles = Collections2.filter(allTestFiles, new Predicate<File>() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user