diff --git a/src/build/ir.rs b/src/build/ir.rs index 4990316..7963002 100644 --- a/src/build/ir.rs +++ b/src/build/ir.rs @@ -59,12 +59,7 @@ impl Val { ) } - pub fn equal( - &self, - target: &Self, - file_name: &str, - pos: Position, - ) -> Result { + pub fn equal(&self, target: &Self, pos: Position) -> Result { // first we do a type equality comparison match (self, target) { // Empty values are always equal. @@ -78,7 +73,7 @@ impl Val { Ok(false) } else { for (i, lv) in ldef.iter().enumerate() { - try!(lv.equal(rdef[i].as_ref(), file_name, pos.clone())); + try!(lv.equal(rdef[i].as_ref(), pos.clone())); } Ok(true) } @@ -94,11 +89,7 @@ impl Val { return Ok(false); } else { // field value equality. - if !try!(lv.1.equal( - field_target.1.as_ref(), - file_name, - lv.0.pos.clone() - )) { + if !try!(lv.1.equal(field_target.1.as_ref(), lv.0.pos.clone())) { return Ok(false); } } @@ -107,17 +98,17 @@ impl Val { } } (&Val::Macro(_), &Val::Macro(_)) => Err(error::BuildError::new( - format!("Macros are not comparable in file: {}", file_name), + "Macros are not comparable", error::ErrorType::TypeFail, pos, )), (&Val::Module(_), &Val::Module(_)) => Err(error::BuildError::new( - format!("Module are not comparable in file: {}", file_name), + "Module are not comparable", error::ErrorType::TypeFail, pos, )), (me, tgt) => Err(error::BuildError::new( - format!("Types differ for {}, {} in file: {}", me, tgt, file_name), + format!("Types differ for {}, {}", me, tgt), error::ErrorType::TypeFail, pos, )), diff --git a/src/build/mod.rs b/src/build/mod.rs index e8f49da..97a3c1b 100644 --- a/src/build/mod.rs +++ b/src/build/mod.rs @@ -210,11 +210,7 @@ impl Builder { &Value::Symbol(ref s) => { self.lookup_sym(&(s.into())) .ok_or(Box::new(error::BuildError::new( - format!( - "Unable to find {} in file: {}", - s.val, - self.file.to_string_lossy() - ), + format!("Unable to find binding {}", s.val,), error::ErrorType::NoSuchSymbol, v.pos().clone(), ))) @@ -375,9 +371,8 @@ impl Builder { format!( "Binding \ for {:?} already \ - exists in file: {}", + exists", e.key(), - self.file.to_string_lossy(), ), error::ErrorType::DuplicateBinding, def.name.pos.clone(), @@ -480,10 +475,8 @@ impl Builder { format!( "Unable to \ match element {} in selector \ - path [{}] in file: {}", - next.1, - sl, - self.file.to_string_lossy(), + path [{}]", + next.1, sl, ), error::ErrorType::NoSuchSymbol, next.0.clone(), @@ -507,10 +500,8 @@ impl Builder { format!( "Unable to \ match element {} in selector \ - path [{}] in file: {}", - next.1, - sl, - self.file.to_string_lossy(), + path [{}]", + next.1, sl, ), error::ErrorType::NoSuchSymbol, next.0.clone(), @@ -720,11 +711,9 @@ impl Builder { left: Rc, right: Rc, ) -> Result, Box> { - Ok(Rc::new(Val::Boolean(try!(left.equal( - right.as_ref(), - &self.file.to_string_lossy(), - pos.clone() - ))))) + Ok(Rc::new(Val::Boolean(try!( + left.equal(right.as_ref(), pos.clone()) + )))) } fn do_not_deep_equal( @@ -733,11 +722,9 @@ impl Builder { left: Rc, right: Rc, ) -> Result, Box> { - Ok(Rc::new(Val::Boolean(!try!(left.equal( - right.as_ref(), - &self.file.to_string_lossy(), - pos.clone() - ))))) + Ok(Rc::new(Val::Boolean(!try!( + left.equal(right.as_ref(), pos.clone()) + )))) } fn do_gt(&self, pos: &Position, left: Rc, right: Rc) -> Result, Box> { diff --git a/src/build/test.rs b/src/build/test.rs index 37cc3ae..5372347 100644 --- a/src/build/test.rs +++ b/src/build/test.rs @@ -140,7 +140,7 @@ fn test_eval_simple_lookup_error() { // Include nested for each. #[test] -#[should_panic(expected = "Unable to find tpl1")] +#[should_panic(expected = "Unable to find binding tpl1")] fn test_expr_copy_no_such_tuple() { let cache = Rc::new(RefCell::new(MemoryCache::new())); let b = Builder::new(std::env::current_dir().unwrap(), cache); @@ -221,7 +221,7 @@ fn test_expr_copy_field_type_error() { } #[test] -#[should_panic(expected = "Unable to find arg1")] +#[should_panic(expected = "Unable to find binding arg1")] fn test_macro_hermetic() { let cache = Rc::new(RefCell::new(MemoryCache::new())); let mut b = Builder::new(std::env::current_dir().unwrap(), cache);