Do not add pre-loaded built-ins when serializing
This commit is contained in:
committed by
Alexander Udalov
parent
c04ecbc1cb
commit
d1d52086d7
Binary file not shown.
Binary file not shown.
@@ -1,2 +1,3 @@
|
|||||||
ΗRΒ0B
|
Η2
|
||||||
|
RΒ0B
|
||||||
r
|
r
|
||||||
@@ -71,7 +71,7 @@ public abstract class AbstractLazyResolveTest extends JetLiteFixture {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
KotlinCodeAnalyzer resolveSession = LazyResolveTestUtil.resolveLazilyWithSession(files, getEnvironment());
|
KotlinCodeAnalyzer resolveSession = LazyResolveTestUtil.resolveLazilyWithSession(files, getEnvironment(), true);
|
||||||
|
|
||||||
NamespaceDescriptor actual = resolveSession.getPackageDescriptor(Name.identifier("test"));
|
NamespaceDescriptor actual = resolveSession.getPackageDescriptor(Name.identifier("test"));
|
||||||
Assert.assertNotNull("Package 'test' was not found", actual);
|
Assert.assertNotNull("Package 'test' was not found", actual);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class LazyResolveTestUtil {
|
|||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KotlinCodeAnalyzer resolveLazilyWithSession(List<JetFile> files, JetCoreEnvironment environment) {
|
public static KotlinCodeAnalyzer resolveLazilyWithSession(List<JetFile> files, JetCoreEnvironment environment, final boolean addBuiltIns) {
|
||||||
JetTestUtils.newTrace(environment);
|
JetTestUtils.newTrace(environment);
|
||||||
|
|
||||||
ModuleDescriptorImpl javaModule = AnalyzerFacadeForJVM.createJavaModule("<java module>");
|
ModuleDescriptorImpl javaModule = AnalyzerFacadeForJVM.createJavaModule("<java module>");
|
||||||
@@ -117,7 +117,7 @@ public class LazyResolveTestUtil {
|
|||||||
@NotNull WritableScope namespaceMemberScope
|
@NotNull WritableScope namespaceMemberScope
|
||||||
) {
|
) {
|
||||||
FqName fqName = DescriptorUtils.getFQName(namespaceDescriptor).toSafe();
|
FqName fqName = DescriptorUtils.getFQName(namespaceDescriptor).toSafe();
|
||||||
if (new FqName("jet").equals(fqName)) {
|
if (KotlinBuiltIns.BUILT_INS_PACKAGE_FQ_NAME.equals(fqName) && addBuiltIns) {
|
||||||
namespaceMemberScope.importScope(KotlinBuiltIns.getInstance().getBuiltInsScope());
|
namespaceMemberScope.importScope(KotlinBuiltIns.getInstance().getBuiltInsScope());
|
||||||
}
|
}
|
||||||
if (psiClassFinder.findPsiPackage(fqName) != null) {
|
if (psiClassFinder.findPsiPackage(fqName) != null) {
|
||||||
@@ -135,7 +135,11 @@ public class LazyResolveTestUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ModuleDescriptor resolveLazily(List<JetFile> files, JetCoreEnvironment environment) {
|
public static ModuleDescriptor resolveLazily(List<JetFile> files, JetCoreEnvironment environment) {
|
||||||
return resolveLazilyWithSession(files, environment).getRootModuleDescriptor();
|
return resolveLazily(files, environment, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ModuleDescriptor resolveLazily(List<JetFile> files, JetCoreEnvironment environment, boolean addBuiltIns) {
|
||||||
|
return resolveLazilyWithSession(files, environment, addBuiltIns).getRootModuleDescriptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class BuiltInsSerializer {
|
|||||||
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
|
JetCoreEnvironment environment = new JetCoreEnvironment(rootDisposable, configuration);
|
||||||
List<JetFile> files = JetTestUtils.loadToJetFiles(environment, sourceFiles);
|
List<JetFile> files = JetTestUtils.loadToJetFiles(environment, sourceFiles);
|
||||||
|
|
||||||
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(files, environment);
|
ModuleDescriptor module = LazyResolveTestUtil.resolveLazily(files, environment, false);
|
||||||
|
|
||||||
FqName fqName = FqName.topLevel(Name.identifier(KotlinBuiltIns.BUILT_INS_PACKAGE_NAME_STRING));
|
FqName fqName = FqName.topLevel(Name.identifier(KotlinBuiltIns.BUILT_INS_PACKAGE_NAME_STRING));
|
||||||
NamespaceDescriptor namespace = module.getNamespace(fqName);
|
NamespaceDescriptor namespace = module.getNamespace(fqName);
|
||||||
|
|||||||
Reference in New Issue
Block a user