From 705e68dc53b6f4b142a0d8a632ce6116c14105e9 Mon Sep 17 00:00:00 2001 From: Yann Hamdaoui Date: Tue, 17 Nov 2020 15:12:02 +0100 Subject: [PATCH] Remove unused global_env cache --- src/program.rs | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/src/program.rs b/src/program.rs index 84562379..37479158 100644 --- a/src/program.rs +++ b/src/program.rs @@ -54,22 +54,6 @@ pub struct Program { file_cache: HashMap, /// Cache storing parsed terms corresponding to the entries of the file database. term_cache: HashMap, - /// The global environment, containing the standard lib. - global_env: GlobalEnvironment, -} - -#[derive(Debug, Clone)] -pub enum GlobalEnvironment { - None, - Loaded(eval::Environment), - Transformed(eval::Environment), - Typechecked(eval::Environment), -} - -impl std::default::Default for GlobalEnvironment { - fn default() -> Self { - GlobalEnvironment::None - } } /// Return status indicating if an import has been resolved from a file (first encounter), or was @@ -132,12 +116,6 @@ impl Program { Program::new_from_source(io::stdin(), "") } - /// Create a program by reading from a file. - pub fn new_from_file>(path: P) -> std::io::Result { - let file = fs::File::open(&path)?; - Program::new_from_source(file, path.as_ref()) - } - /// Create a program by reading it from a generic source. pub fn new_from_source( mut source: T, @@ -154,7 +132,6 @@ impl Program { files, file_cache: HashMap::new(), term_cache: HashMap::new(), - global_env: GlobalEnvironment::default(), }) } @@ -1491,7 +1468,7 @@ Assume(#alwaysTrue -> #alwaysFalse, not ) true eval_string( " let f = Assume( - forall a. ((forall b. ({a: Num, b: Num |b} }) + forall a. ((forall b. ({a: Num, b: Num |b} }) -> ({ a: Num | b})) -> {a: Num | a} -> { | a}), @@ -1530,7 +1507,7 @@ Assume(#alwaysTrue -> #alwaysFalse, not ) true // /!\ Trailing spaces on the middle line are on purpose, don't remove ! /!\ assert_peq!( - r##" + r##" m#" ignore @@ -1540,8 +1517,9 @@ Assume(#alwaysTrue -> #alwaysFalse, not ) true "\"ignore\n\n empty line indent\"" ); + // /!\ Trailing spaces on the middle line are on purpose, don't remove ! /!\ assert_peq!( - r##" + r##" m#" ignore @@ -1570,7 +1548,7 @@ Assume(#alwaysTrue -> #alwaysFalse, not ) true #[test] fn multiline_interpolation() { assert_peq!( - r###" + r###" m#" ${m#"thi"#m ++ "s"} ${"is" ++ " an"}