Error Messaging Redesign

This commit contains the following:

* New data types to support full tracebacks
* New traceback data type used across stl and ast
* Updates to tests
* fixes for error messaging in sym and some stl functions
This commit is contained in:
Ava Apples Affine 2023-05-23 22:06:11 +00:00
parent 91ad4eed12
commit 789349df48
24 changed files with 837 additions and 374 deletions

View file

@ -665,8 +665,8 @@ mod math_lib_tests {
eval(&doc_tree, &mut syms).unwrap();
if let Err(s) = eval(&change_tree, &mut syms) {
assert_eq!(
s,
"error in call to inc: can only increment an integer".to_string()
s.0.first().unwrap().message,
"expected tester to be an integer".to_string()
);
let intermediate = *eval(&check_tree, &mut syms).unwrap();
if let Ctr::Seg(ref s) = intermediate {
@ -698,8 +698,8 @@ mod math_lib_tests {
eval(&doc_tree, &mut syms).unwrap();
if let Err(s) = eval(&change_tree, &mut syms) {
assert_eq!(
s,
"error in call to inc: cannot increment a function".to_string()
s.0.first().unwrap().message,
"expected tester to be an integer".to_string()
);
if let Ctr::String(ref s) = *eval(&check_tree, &mut syms).unwrap() {
assert_eq!(*s, "1".to_string());
@ -768,8 +768,8 @@ mod math_lib_tests {
eval(&doc_tree, &mut syms).unwrap();
if let Err(s) = eval(&change_tree, &mut syms) {
assert_eq!(
s,
"error in call to dec: can only decrement an integer".to_string()
s.0.first().unwrap().message,
"expected tester to be an integer".to_string()
);
let intermediate = *eval(&check_tree, &mut syms).unwrap();
if let Ctr::Seg(ref s) = intermediate {
@ -801,8 +801,8 @@ mod math_lib_tests {
eval(&doc_tree, &mut syms).unwrap();
if let Err(s) = eval(&change_tree, &mut syms) {
assert_eq!(
s,
"error in call to dec: cannot decrement a function".to_string()
s.0.first().unwrap().message,
"expected tester to be an integer".to_string()
);
if let Ctr::String(ref s) = *eval(&check_tree, &mut syms).unwrap() {
assert_eq!(*s, "1".to_string());