From 8396bfa165412924f6f4d061871aed548af15383 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Fri, 5 Jan 2024 08:03:34 +0100 Subject: [PATCH] Avoid using cached bindings when the module isn't loaded from cache (#8669) --- .../src/main/scala/org/enso/compiler/Compiler.scala | 5 ++++- .../src/main/java/org/enso/interpreter/caches/Cache.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/engine/runtime-compiler/src/main/scala/org/enso/compiler/Compiler.scala b/engine/runtime-compiler/src/main/scala/org/enso/compiler/Compiler.scala index 69161dc5ea30..2c6210ec1e23 100644 --- a/engine/runtime-compiler/src/main/scala/org/enso/compiler/Compiler.scala +++ b/engine/runtime-compiler/src/main/scala/org/enso/compiler/Compiler.scala @@ -259,9 +259,12 @@ class Compiler( ) val requiredModules = modules.flatMap { module => - val importedModules = runImportsAndExportsResolution(module, generateCode) val isLoadedFromSource = (m: Module) => !context.wasLoadedFromCache(m) && !context.isSynthetic(m) + val importedModules = runImportsAndExportsResolution( + module, + generateCode && context.wasLoadedFromCache(module) + ) if ( shouldCompileDependencies && context.wasLoadedFromCache(module) && diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java index f83cd8bf0486..0e3c4ca579d0 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/Cache.java @@ -218,6 +218,9 @@ public final Optional load(EnsoContext context) { } logger.log(logLevel, "Unable to load a cache [" + logName + "]"); + } catch (IOException e) { + logger.log( + Level.FINE, "Unable to load a cache [" + logName + "]: " + e.getMessage(), e); } catch (Exception e) { logger.log( Level.WARNING,