Merge remote-tracking branch 'origin/main' into abilities-syntax

This commit is contained in:
Richard Feldman 2023-08-10 20:29:27 -04:00
commit 2da41be29f
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
524 changed files with 47536 additions and 15089 deletions

View file

@ -8,6 +8,7 @@ extern crate bumpalo;
#[cfg(test)]
mod solve_expr {
use roc_load::LoadedModule;
use roc_solve::FunctionKind;
use test_solve_helpers::{format_problems, run_load_and_infer};
use roc_types::pretty_print::{name_and_print_var, DebugPrint};
@ -27,7 +28,7 @@ mod solve_expr {
..
},
src,
) = run_load_and_infer(src, [], false)?;
) = run_load_and_infer(src, [], false, FunctionKind::LambdaSet)?;
let mut can_problems = can_problems.remove(&home).unwrap_or_default();
let type_problems = type_problems.remove(&home).unwrap_or_default();
@ -49,7 +50,7 @@ mod solve_expr {
exposed_to_host.retain(|s, _| !abilities_store.is_specialization_name(*s));
debug_assert!(exposed_to_host.len() == 1, "{:?}", exposed_to_host);
debug_assert!(exposed_to_host.len() == 1, "{exposed_to_host:?}");
let (_symbol, variable) = exposed_to_host.into_iter().next().unwrap();
let actual_str = name_and_print_var(variable, subs, home, &interns, DebugPrint::NOTHING);
@ -61,8 +62,7 @@ mod solve_expr {
assert!(
can_problems.is_empty(),
"Canonicalization problems: {}",
can_problems
"Canonicalization problems: {can_problems}"
);
assert_eq!(actual, expected.to_string());
@ -73,17 +73,13 @@ mod solve_expr {
assert!(
can_problems.is_empty(),
"Canonicalization problems: {}",
can_problems
"Canonicalization problems: {can_problems}"
);
if !type_problems.is_empty() {
// fail with an assert, but print the problems normally so rust doesn't try to diff
// an empty vec with the problems.
panic!(
"expected:\n{:?}\ninferred:\n{:?}\nproblems:\n{}",
expected, actual, type_problems,
);
panic!("expected:\n{expected:?}\ninferred:\n{actual:?}\nproblems:\n{type_problems}",);
}
assert_eq!(actual, expected.to_string());
}
@ -3797,11 +3793,11 @@ mod solve_expr {
}
#[test]
fn str_trim_left() {
fn str_trim_start() {
infer_eq_without_problem(
indoc!(
r#"
Str.trimLeft
Str.trimStart
"#
),
"Str -> Str",