Skip to content

Commit a906626

Browse files
committed
Standardize workspace: Justfile migration and A2ML directive cleanup
1 parent 7bd5430 commit a906626

21 files changed

Lines changed: 226 additions & 369 deletions

File tree

bindings/chapel/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! Build script to generate C header for Chapel
33
44
fn main() {
5-
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
5+
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").expect("TODO: handle error");
66

77
cbindgen::Builder::new()
88
.with_crate(crate_dir)

bindings/chapel/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub extern "C" fn bet_uniform(low: c_double, high: c_double) -> c_double {
131131
/// Standard normal (mean=0, std=1)
132132
#[no_mangle]
133133
pub extern "C" fn bet_standard_normal() -> c_double {
134-
let dist = Normal::new(0.0, 1.0).unwrap();
134+
let dist = Normal::new(0.0, 1.0).expect("TODO: handle error");
135135
dist.sample(&mut thread_rng())
136136
}
137137

bindings/julia/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub extern "C" fn bet_uniform(low: c_double, high: c_double) -> c_double {
121121

122122
#[no_mangle]
123123
pub extern "C" fn bet_standard_normal() -> c_double {
124-
Normal::new(0.0, 1.0).unwrap().sample(&mut thread_rng())
124+
Normal::new(0.0, 1.0).expect("TODO: handle error").sample(&mut thread_rng())
125125
}
126126

127127
#[no_mangle]

compiler/bet-check/src/lib.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,15 @@ mod tests {
916916
#[test]
917917
fn test_literal_types() {
918918
let mut env = CheckEnv::new();
919-
assert_eq!(check_expr(&dummy(Expr::Int(42)), &mut env).unwrap(), Type::Int);
920-
assert_eq!(check_expr(&dummy(Expr::Float(3.14)), &mut env).unwrap(), Type::Float);
921-
assert_eq!(check_expr(&dummy(Expr::Bool(true)), &mut env).unwrap(), Type::Bool);
919+
assert_eq!(check_expr(&dummy(Expr::Int(42)), &mut env).expect("TODO: handle error"), Type::Int);
920+
assert_eq!(check_expr(&dummy(Expr::Float(3.14)), &mut env).expect("TODO: handle error"), Type::Float);
921+
assert_eq!(check_expr(&dummy(Expr::Bool(true)), &mut env).expect("TODO: handle error"), Type::Bool);
922922
assert_eq!(
923-
check_expr(&dummy(Expr::Ternary(TernaryValue::Unknown)), &mut env).unwrap(),
923+
check_expr(&dummy(Expr::Ternary(TernaryValue::Unknown)), &mut env).expect("TODO: handle error"),
924924
Type::Ternary
925925
);
926-
assert_eq!(check_expr(&dummy(Expr::String("hi".into())), &mut env).unwrap(), Type::String);
927-
assert_eq!(check_expr(&dummy(Expr::Unit), &mut env).unwrap(), Type::Unit);
926+
assert_eq!(check_expr(&dummy(Expr::String("hi".into())), &mut env).expect("TODO: handle error"), Type::String);
927+
assert_eq!(check_expr(&dummy(Expr::Unit), &mut env).expect("TODO: handle error"), Type::Unit);
928928
}
929929

930930
#[test]
@@ -939,7 +939,7 @@ mod tests {
939939
let mut env = CheckEnv::new();
940940
env.bind("x".to_string(), Type::Int);
941941
let result = check_expr(&dummy(Expr::Var(Symbol::intern("x"))), &mut env);
942-
assert_eq!(result.unwrap(), Type::Int);
942+
assert_eq!(result.expect("TODO: handle error"), Type::Int);
943943
}
944944

945945
#[test]
@@ -953,7 +953,7 @@ mod tests {
953953
],
954954
};
955955
let result = check_expr(&dummy(Expr::Bet(bet)), &mut env);
956-
assert_eq!(result.unwrap(), Type::Int);
956+
assert_eq!(result.expect("TODO: handle error"), Type::Int);
957957
}
958958

959959
#[test]
@@ -1003,7 +1003,7 @@ mod tests {
10031003
else_branch: Box::new(dummy(Expr::Int(2))),
10041004
};
10051005
let result = check_expr(&dummy(Expr::If(if_expr)), &mut env);
1006-
assert_eq!(result.unwrap(), Type::Int);
1006+
assert_eq!(result.expect("TODO: handle error"), Type::Int);
10071007
}
10081008

10091009
#[test]
@@ -1012,7 +1012,7 @@ mod tests {
10121012
env.bind("d".to_string(), Type::Dist(Box::new(Type::Float)));
10131013
let sample = Expr::Sample(Box::new(dummy(Expr::Var(Symbol::intern("d")))));
10141014
let result = check_expr(&dummy(sample), &mut env);
1015-
assert_eq!(result.unwrap(), Type::Float);
1015+
assert_eq!(result.expect("TODO: handle error"), Type::Float);
10161016
}
10171017

10181018
#[test]
@@ -1033,7 +1033,7 @@ mod tests {
10331033
Box::new(dummy(Expr::Int(5))),
10341034
);
10351035
let result = check_expr(&dummy(observe), &mut env);
1036-
assert_eq!(result.unwrap(), Type::Unit);
1036+
assert_eq!(result.expect("TODO: handle error"), Type::Unit);
10371037
}
10381038

10391039
#[test]
@@ -1057,15 +1057,15 @@ mod tests {
10571057
Box::new(dummy(Expr::Int(1))),
10581058
Box::new(dummy(Expr::Int(2))),
10591059
);
1060-
assert_eq!(check_expr(&dummy(add), &mut env).unwrap(), Type::Int);
1060+
assert_eq!(check_expr(&dummy(add), &mut env).expect("TODO: handle error"), Type::Int);
10611061

10621062
// Float * Int = Float
10631063
let mul = Expr::BinOp(
10641064
BinOp::Mul,
10651065
Box::new(dummy(Expr::Float(1.0))),
10661066
Box::new(dummy(Expr::Int(2))),
10671067
);
1068-
assert_eq!(check_expr(&dummy(mul), &mut env).unwrap(), Type::Float);
1068+
assert_eq!(check_expr(&dummy(mul), &mut env).expect("TODO: handle error"), Type::Float);
10691069
}
10701070

10711071
#[test]
@@ -1076,7 +1076,7 @@ mod tests {
10761076
Box::new(dummy(Expr::Int(1))),
10771077
Box::new(dummy(Expr::Int(2))),
10781078
);
1079-
assert_eq!(check_expr(&dummy(cmp), &mut env).unwrap(), Type::Bool);
1079+
assert_eq!(check_expr(&dummy(cmp), &mut env).expect("TODO: handle error"), Type::Bool);
10801080
}
10811081

10821082
#[test]
@@ -1087,14 +1087,14 @@ mod tests {
10871087
Box::new(dummy(Expr::Bool(true))),
10881088
Box::new(dummy(Expr::Ternary(TernaryValue::Unknown))),
10891089
);
1090-
assert_eq!(check_expr(&dummy(and), &mut env).unwrap(), Type::Ternary);
1090+
assert_eq!(check_expr(&dummy(and), &mut env).expect("TODO: handle error"), Type::Ternary);
10911091
}
10921092

10931093
#[test]
10941094
fn test_unify_basic() {
10951095
let mut env = CheckEnv::new();
10961096
let a = env.fresh_var();
1097-
env.unify(&a, &Type::Int, None).unwrap();
1097+
env.unify(&a, &Type::Int, None).expect("TODO: handle error");
10981098
assert_eq!(env.resolve(&a), Type::Int);
10991099
}
11001100

@@ -1113,7 +1113,7 @@ mod tests {
11131113
dummy(Expr::Int(2)),
11141114
dummy(Expr::Int(3)),
11151115
]);
1116-
let result = check_expr(&dummy(list), &mut env).unwrap();
1116+
let result = check_expr(&dummy(list), &mut env).expect("TODO: handle error");
11171117
assert_eq!(result, Type::List(Box::new(Type::Int)));
11181118
}
11191119

@@ -1124,22 +1124,22 @@ mod tests {
11241124
dummy(Expr::Int(1)),
11251125
dummy(Expr::String("hi".into())),
11261126
]);
1127-
let result = check_expr(&dummy(tuple), &mut env).unwrap();
1127+
let result = check_expr(&dummy(tuple), &mut env).expect("TODO: handle error");
11281128
assert_eq!(result, Type::Tuple(vec![Type::Int, Type::String]));
11291129
}
11301130

11311131
#[test]
11321132
fn test_negation_numeric() {
11331133
let mut env = CheckEnv::new();
11341134
let neg = Expr::UnOp(UnOp::Neg, Box::new(dummy(Expr::Int(5))));
1135-
assert_eq!(check_expr(&dummy(neg), &mut env).unwrap(), Type::Int);
1135+
assert_eq!(check_expr(&dummy(neg), &mut env).expect("TODO: handle error"), Type::Int);
11361136
}
11371137

11381138
#[test]
11391139
fn test_not_on_bool() {
11401140
let mut env = CheckEnv::new();
11411141
let not = Expr::UnOp(UnOp::Not, Box::new(dummy(Expr::Bool(true))));
1142-
assert_eq!(check_expr(&dummy(not), &mut env).unwrap(), Type::Ternary);
1142+
assert_eq!(check_expr(&dummy(not), &mut env).expect("TODO: handle error"), Type::Ternary);
11431143
}
11441144

11451145
#[test]
@@ -1149,7 +1149,7 @@ mod tests {
11491149
Box::new(dummy(Expr::Int(100))),
11501150
Box::new(dummy(Expr::Float(3.14))),
11511151
);
1152-
let result = check_expr(&dummy(par), &mut env).unwrap();
1152+
let result = check_expr(&dummy(par), &mut env).expect("TODO: handle error");
11531153
assert_eq!(result, Type::List(Box::new(Type::Float)));
11541154
}
11551155
}

0 commit comments

Comments
 (0)