From 67cf459745ef3df17b1cf1a1cbe1393e53890d5c Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Thu, 11 May 2023 09:36:52 +0200 Subject: [PATCH] Force loading from cache before asking ensureParsed --- .../org/enso/compiler/phase/ImportResolver.scala | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/engine/runtime/src/main/scala/org/enso/compiler/phase/ImportResolver.scala b/engine/runtime/src/main/scala/org/enso/compiler/phase/ImportResolver.scala index 286dbebb5200..1f4a492ec86d 100644 --- a/engine/runtime/src/main/scala/org/enso/compiler/phase/ImportResolver.scala +++ b/engine/runtime/src/main/scala/org/enso/compiler/phase/ImportResolver.scala @@ -58,7 +58,7 @@ class ImportResolver(compiler: Compiler) { ] = ir.imports.map { case imp: IR.Module.Scope.Import.Module => - tryResolveImport(ir, imp) + tryResolveImport(ir, imp, bindingsCachingEnabled) case other => (other, None) } currentLocal.resolvedImports = importedModules.flatMap(_._2) @@ -100,6 +100,7 @@ class ImportResolver(compiler: Compiler) { concreteBindings } current.bindings = converted.getOrElse(null) + current.bindings = converted.getOrElse(null) ( converted .map( @@ -133,11 +134,13 @@ class ImportResolver(compiler: Compiler) { } private def tryResolveAsType( - name: IR.Name.Qualified + name: IR.Name.Qualified, + bindingsCachingEnabled: Boolean ): Option[ResolvedType] = { val tp = name.parts.last.name val mod = name.parts.dropRight(1).map(_.name).mkString(".") compiler.getModule(mod).flatMap { mod => + mapImports(mod, bindingsCachingEnabled) compiler.ensureParsed(mod) mod.getIr .unsafeGetMetadata( @@ -154,7 +157,8 @@ class ImportResolver(compiler: Compiler) { private def tryResolveImport( module: IR.Module, - imp: Import.Module + imp: Import.Module, + bindingsCachingEnabled: Boolean ): (IR.Module.Scope.Import, Option[BindingsMap.ResolvedImport]) = { val impName = imp.name.name val exp = module.exports @@ -242,7 +246,7 @@ class ImportResolver(compiler: Compiler) { ) ) case None => - tryResolveAsType(imp.name) match { + tryResolveAsType(imp.name, bindingsCachingEnabled) match { case Some(tp) => (imp, Some(BindingsMap.ResolvedImport(imp, exp, tp))) case None =>