diff --git a/nac3core/src/typecheck/expression_inference.rs b/nac3core/src/typecheck/expression_inference.rs index 4f3ee8146..3e90eb960 100644 --- a/nac3core/src/typecheck/expression_inference.rs +++ b/nac3core/src/typecheck/expression_inference.rs @@ -659,6 +659,9 @@ pub mod test { #[test_case("1 if True else False")] #[test_case("1 and 2")] #[test_case("False or 1")] + #[test_case("1 + False")] + #[test_case("1 < 2 > False")] + #[test_case("not 2")] fn test_err_msg(prog: &'static str) { let mut inf = new_ctx(); let ast = rustpython_parser::parser::parse_expression(prog).unwrap(); diff --git a/nac3core/src/typecheck/symbol_resolver.rs b/nac3core/src/typecheck/symbol_resolver.rs index a5328491c..c96e75d5d 100644 --- a/nac3core/src/typecheck/symbol_resolver.rs +++ b/nac3core/src/typecheck/symbol_resolver.rs @@ -1,6 +1,11 @@ use super::typedef::Type; use super::location::Location; -use rustpython_parser::ast::Expr; + +pub enum SymbolType { + TypeName(Type), + Identifier(Type), +} + pub enum SymbolValue<'a> { I32(i32), I64(i64), @@ -9,10 +14,10 @@ pub enum SymbolValue<'a> { Tuple(&'a [SymbolValue<'a>]), Bytes(&'a [u8]), } + pub trait SymbolResolver { - fn get_symbol_type(&mut self, str: &str) -> Option; - fn parse_type_name(&mut self, expr: &Expr<()>) -> Option; - fn get_symbol_value(&mut self, str: &str) -> Option; - fn get_symbol_location(&mut self, str: &str) -> Option; + fn get_symbol_type(&self, str: &str) -> Option; + fn get_symbol_value(&self, str: &str) -> Option; + fn get_symbol_location(&self, str: &str) -> Option; // handle function call etc. } \ No newline at end of file