mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
Fix test compile errors, and simply load_internal tests
This commit is contained in:
parent
cbbbb8c855
commit
865c1f15d7
7 changed files with 41 additions and 15 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -3737,7 +3737,6 @@ dependencies = [
|
||||||
"roc_target",
|
"roc_target",
|
||||||
"roc_types",
|
"roc_types",
|
||||||
"roc_unify",
|
"roc_unify",
|
||||||
"strip-ansi-escapes",
|
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"ven_pretty",
|
"ven_pretty",
|
||||||
]
|
]
|
||||||
|
@ -4526,6 +4525,7 @@ dependencies = [
|
||||||
"roc_load",
|
"roc_load",
|
||||||
"roc_module",
|
"roc_module",
|
||||||
"roc_mono",
|
"roc_mono",
|
||||||
|
"roc_reporting",
|
||||||
"roc_target",
|
"roc_target",
|
||||||
"test_mono_macros",
|
"test_mono_macros",
|
||||||
]
|
]
|
||||||
|
|
|
@ -33,4 +33,3 @@ tempfile = "3.2.0"
|
||||||
pretty_assertions = "1.0.0"
|
pretty_assertions = "1.0.0"
|
||||||
maplit = "1.0.2"
|
maplit = "1.0.2"
|
||||||
indoc = "1.0.3"
|
indoc = "1.0.3"
|
||||||
strip-ansi-escapes = "0.1.1"
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ mod test_load {
|
||||||
use roc_problem::can::Problem;
|
use roc_problem::can::Problem;
|
||||||
use roc_region::all::LineInfo;
|
use roc_region::all::LineInfo;
|
||||||
use roc_reporting::report::can_problem;
|
use roc_reporting::report::can_problem;
|
||||||
|
use roc_reporting::report::RenderTarget;
|
||||||
use roc_reporting::report::RocDocAllocator;
|
use roc_reporting::report::RocDocAllocator;
|
||||||
use roc_target::TargetInfo;
|
use roc_target::TargetInfo;
|
||||||
use roc_types::pretty_print::{content_to_string, name_all_type_vars};
|
use roc_types::pretty_print::{content_to_string, name_all_type_vars};
|
||||||
|
@ -41,7 +42,7 @@ mod test_load {
|
||||||
) -> Result<LoadedModule, LoadingProblem<'a>> {
|
) -> Result<LoadedModule, LoadingProblem<'a>> {
|
||||||
use LoadResult::*;
|
use LoadResult::*;
|
||||||
|
|
||||||
let load_start = LoadStart::from_path(arena, filename)?;
|
let load_start = LoadStart::from_path(arena, filename, RenderTarget::Generic)?;
|
||||||
|
|
||||||
match roc_load_internal::file::load(
|
match roc_load_internal::file::load(
|
||||||
arena,
|
arena,
|
||||||
|
@ -51,6 +52,7 @@ mod test_load {
|
||||||
Phase::SolveTypes,
|
Phase::SolveTypes,
|
||||||
target_info,
|
target_info,
|
||||||
Default::default(), // these tests will re-compile the builtins
|
Default::default(), // these tests will re-compile the builtins
|
||||||
|
RenderTarget::Generic,
|
||||||
)? {
|
)? {
|
||||||
Monomorphized(_) => unreachable!(""),
|
Monomorphized(_) => unreachable!(""),
|
||||||
TypeChecked(module) => Ok(module),
|
TypeChecked(module) => Ok(module),
|
||||||
|
@ -88,8 +90,6 @@ mod test_load {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn multiple_modules(files: Vec<(&str, &str)>) -> Result<LoadedModule, String> {
|
fn multiple_modules(files: Vec<(&str, &str)>) -> Result<LoadedModule, String> {
|
||||||
use roc_load_internal::file::LoadingProblem;
|
|
||||||
|
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
let arena = &arena;
|
let arena = &arena;
|
||||||
|
|
||||||
|
@ -589,18 +589,18 @@ mod test_load {
|
||||||
report,
|
report,
|
||||||
indoc!(
|
indoc!(
|
||||||
"
|
"
|
||||||
\u{1b}[36m── UNFINISHED LIST ─────────────────────────────────────────────────────────────\u{1b}[0m
|
── UNFINISHED LIST ─────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
I cannot find the end of this list:
|
I cannot find the end of this list:
|
||||||
|
|
||||||
\u{1b}[36m3\u{1b}[0m\u{1b}[36m│\u{1b}[0m \u{1b}[37mmain = [\u{1b}[0m
|
3│ main = [
|
||||||
\u{1b}[31m^\u{1b}[0m
|
^
|
||||||
|
|
||||||
You could change it to something like \u{1b}[33m[ 1, 2, 3 ]\u{1b}[0m or even just \u{1b}[33m[]\u{1b}[0m.
|
You could change it to something like [ 1, 2, 3 ] or even just [].
|
||||||
Anything where there is an open and a close square bracket, and where
|
Anything where there is an open and a close square bracket, and where
|
||||||
the elements of the list are separated by commas.
|
the elements of the list are separated by commas.
|
||||||
|
|
||||||
\u{1b}[4mNote\u{1b}[0m: I may be confused by indentation"
|
Note: I may be confused by indentation"
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Ok(_) => unreachable!("we expect failure here"),
|
Ok(_) => unreachable!("we expect failure here"),
|
||||||
|
@ -769,8 +769,6 @@ mod test_load {
|
||||||
];
|
];
|
||||||
|
|
||||||
let err = multiple_modules(modules).unwrap_err();
|
let err = multiple_modules(modules).unwrap_err();
|
||||||
let err = strip_ansi_escapes::strip(err).unwrap();
|
|
||||||
let err = String::from_utf8(err).unwrap();
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
err,
|
err,
|
||||||
indoc!(
|
indoc!(
|
||||||
|
|
|
@ -7,6 +7,7 @@ use roc_collections::all::MutSet;
|
||||||
use roc_gen_llvm::llvm::externs::add_default_roc_externs;
|
use roc_gen_llvm::llvm::externs::add_default_roc_externs;
|
||||||
use roc_mono::ir::OptLevel;
|
use roc_mono::ir::OptLevel;
|
||||||
use roc_region::all::LineInfo;
|
use roc_region::all::LineInfo;
|
||||||
|
use roc_reporting::report::RenderTarget;
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
|
|
||||||
fn promote_expr_to_module(src: &str) -> String {
|
fn promote_expr_to_module(src: &str) -> String {
|
||||||
|
@ -57,6 +58,7 @@ fn create_llvm_module<'a>(
|
||||||
src_dir,
|
src_dir,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
target_info,
|
target_info,
|
||||||
|
RenderTarget::ColorTerminal,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut loaded = match loaded {
|
let mut loaded = match loaded {
|
||||||
|
|
|
@ -17,6 +17,7 @@ roc_load = { path = "../load" }
|
||||||
roc_can = { path = "../can" }
|
roc_can = { path = "../can" }
|
||||||
roc_mono = { path = "../mono" }
|
roc_mono = { path = "../mono" }
|
||||||
roc_target = { path = "../roc_target" }
|
roc_target = { path = "../roc_target" }
|
||||||
|
roc_reporting = { path = "../../reporting" }
|
||||||
test_mono_macros = { path = "../test_mono_macros" }
|
test_mono_macros = { path = "../test_mono_macros" }
|
||||||
pretty_assertions = "1.0.0"
|
pretty_assertions = "1.0.0"
|
||||||
bumpalo = { version = "3.8.0", features = ["collections"] }
|
bumpalo = { version = "3.8.0", features = ["collections"] }
|
||||||
|
|
|
@ -101,6 +101,7 @@ fn compiles_to_ir(test_name: &str, src: &str) {
|
||||||
src_dir,
|
src_dir,
|
||||||
Default::default(),
|
Default::default(),
|
||||||
TARGET_INFO,
|
TARGET_INFO,
|
||||||
|
roc_reporting::report::RenderTarget::Generic,
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut loaded = match loaded {
|
let mut loaded = match loaded {
|
||||||
|
|
|
@ -9462,4 +9462,29 @@ I need all branches in an `if` to have the same type!
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ability_specialization_is_incomplete() {
|
||||||
|
new_report_problem_as(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "test" provides [ eq, le ] to "./platform"
|
||||||
|
|
||||||
|
Eq has
|
||||||
|
eq : a, a -> Bool | a has Eq
|
||||||
|
le : a, a -> Bool | a has Eq
|
||||||
|
|
||||||
|
Id := U64
|
||||||
|
|
||||||
|
eq = \$Id m, $Id n -> m == n
|
||||||
|
|
||||||
|
le = \$Id m, $Id n -> m < n
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue