diff --git a/repl/src/repl.rs b/repl/src/repl.rs index 9d06403b35..bcce9cc86c 100644 --- a/repl/src/repl.rs +++ b/repl/src/repl.rs @@ -633,8 +633,8 @@ pub fn run( use_std_lib: bool, ) -> impl Future { let vm = ::gluon::VmBuilder::new().build(); - vm.global_env().debug_level(debug_level); - vm.get_Database_mut().use_standard_lib(use_std_lib); + vm.global_env().set_debug_level(debug_level); + vm.get_database_mut().use_standard_lib(use_std_lib); try_future!( compile_repl(&vm).map_err(|err| err.emit_string(&vm.get_database().code_map()).unwrap()), diff --git a/src/lib.rs b/src/lib.rs index 1e2fdecc8c..04c5b6efb6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -461,6 +461,14 @@ pub trait ThreadExt { expected_type: Option<&ArcType>, ) -> Result<(Arc>, ArcType)> { let vm = self.thread(); + { + use salsa::Database; + let mut db = vm.get_database_mut(); + if db.module_text(file.into()).as_ref().map(|s| &s[..]).ok() != Some(expr_str) { + db.query_mut(crate::query::ModuleTextQuery) + .invalidate(&file.into()); + } + } let db = get_db_snapshot(&vm); db.compiler() .state() diff --git a/src/query.rs b/src/query.rs index f9653cd651..05d9ba36ee 100644 --- a/src/query.rs +++ b/src/query.rs @@ -523,7 +523,13 @@ impl CompilerEnv for CompilerDatabase { self.get_global(id.definition_name()) .map(|g| (Variable::UpVar(g.id.clone()), g.typ.clone())) } else { - None + let name = id.definition_name(); + + let globals = self.thread().global_env().get_globals(); + globals + .globals + .get(name) + .map(|g| (Variable::UpVar(g.id.clone()), g.typ.clone())) } } } @@ -548,7 +554,10 @@ impl TypeEnv for CompilerDatabase { if id.is_global() { self.get_global(id.definition_name()).map(|g| g.typ.clone()) } else { - None + let name = id.definition_name(); + + let globals = self.thread().global_env().get_globals(); + globals.globals.get(name).map(|global| global.typ.clone()) } }