mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
fix tests
This commit is contained in:
parent
76f9444e46
commit
ac3788ba85
4 changed files with 21 additions and 21 deletions
|
@ -2120,11 +2120,11 @@ fn load_pkg_config<'a>(
|
||||||
|
|
||||||
let effects_module_msg = fabricate_effects_module(
|
let effects_module_msg = fabricate_effects_module(
|
||||||
arena,
|
arena,
|
||||||
header.effects.type_shortname, //shorthand,
|
header.effects.effect_shortname,
|
||||||
module_ids,
|
module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
mode,
|
mode,
|
||||||
&header.effects,
|
header,
|
||||||
effect_module_timing,
|
effect_module_timing,
|
||||||
)
|
)
|
||||||
.map(|x| x.1)?;
|
.map(|x| x.1)?;
|
||||||
|
@ -2373,7 +2373,7 @@ fn parse_header<'a>(
|
||||||
module_ids,
|
module_ids,
|
||||||
ident_ids_by_module,
|
ident_ids_by_module,
|
||||||
mode,
|
mode,
|
||||||
&header.effects,
|
header,
|
||||||
module_timing,
|
module_timing,
|
||||||
),
|
),
|
||||||
Err((fail, _)) => Err(LoadingProblem::ParsingFailed { filename, fail }),
|
Err((fail, _)) => Err(LoadingProblem::ParsingFailed { filename, fail }),
|
||||||
|
@ -3020,18 +3020,18 @@ fn fabricate_effects_module<'a>(
|
||||||
module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
|
||||||
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
ident_ids_by_module: Arc<Mutex<MutMap<ModuleId, IdentIds>>>,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
// header: PlatformHeader<'a>,
|
header: PlatformHeader<'a>,
|
||||||
effects: &roc_parse::header::Effects<'a>,
|
|
||||||
module_timing: ModuleTiming,
|
module_timing: ModuleTiming,
|
||||||
) -> Result<(ModuleId, Msg<'a>), LoadingProblem> {
|
) -> Result<(ModuleId, Msg<'a>), LoadingProblem> {
|
||||||
// let num_exposes = header.provides.len() + 1;
|
let num_exposes = header.provides.len() + 1;
|
||||||
let num_exposes = 0;
|
|
||||||
let mut exposed: Vec<Symbol> = Vec::with_capacity(num_exposes);
|
let mut exposed: Vec<Symbol> = Vec::with_capacity(num_exposes);
|
||||||
|
|
||||||
|
let effects = header.effects;
|
||||||
|
|
||||||
let module_id: ModuleId;
|
let module_id: ModuleId;
|
||||||
|
|
||||||
let effect_entries = unpack_exposes_entries(arena, &effects.entries);
|
let effect_entries = unpack_exposes_entries(arena, &effects.entries);
|
||||||
let name = effects.type_name;
|
let name = effects.effect_type_name;
|
||||||
let declared_name: ModuleName = name.into();
|
let declared_name: ModuleName = name.into();
|
||||||
|
|
||||||
let hardcoded_effect_symbols = {
|
let hardcoded_effect_symbols = {
|
||||||
|
@ -3044,7 +3044,6 @@ fn fabricate_effects_module<'a>(
|
||||||
functions
|
functions
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
let mut module_ids = (*module_ids).lock();
|
let mut module_ids = (*module_ids).lock();
|
||||||
|
|
||||||
|
@ -3054,7 +3053,6 @@ fn fabricate_effects_module<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
let exposed_ident_ids = {
|
let exposed_ident_ids = {
|
||||||
// Lock just long enough to perform the minimal operations necessary.
|
// Lock just long enough to perform the minimal operations necessary.
|
||||||
|
@ -3255,7 +3253,7 @@ fn fabricate_effects_module<'a>(
|
||||||
Ok((
|
Ok((
|
||||||
module_id,
|
module_id,
|
||||||
Msg::MadeEffectModule {
|
Msg::MadeEffectModule {
|
||||||
type_shortname: effects.type_shortname,
|
type_shortname: effects.effect_shortname,
|
||||||
constrained_module,
|
constrained_module,
|
||||||
canonicalization_problems: module_output.problems,
|
canonicalization_problems: module_output.problems,
|
||||||
module_docs,
|
module_docs,
|
||||||
|
|
|
@ -149,8 +149,8 @@ pub struct Effects<'a> {
|
||||||
pub spaces_before_effects_keyword: &'a [CommentOrNewline<'a>],
|
pub spaces_before_effects_keyword: &'a [CommentOrNewline<'a>],
|
||||||
pub spaces_after_effects_keyword: &'a [CommentOrNewline<'a>],
|
pub spaces_after_effects_keyword: &'a [CommentOrNewline<'a>],
|
||||||
pub spaces_after_type_name: &'a [CommentOrNewline<'a>],
|
pub spaces_after_type_name: &'a [CommentOrNewline<'a>],
|
||||||
pub type_shortname: &'a str,
|
pub effect_shortname: &'a str,
|
||||||
pub type_name: &'a str,
|
pub effect_type_name: &'a str,
|
||||||
pub entries: &'a [Loc<TypedIdent<'a>>],
|
pub entries: &'a [Loc<TypedIdent<'a>>],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -511,8 +511,8 @@ fn effects<'a>() -> impl Parser<'a, Effects<'a>> {
|
||||||
spaces_before_effects_keyword,
|
spaces_before_effects_keyword,
|
||||||
spaces_after_effects_keyword,
|
spaces_after_effects_keyword,
|
||||||
spaces_after_type_name,
|
spaces_after_type_name,
|
||||||
type_shortname,
|
effect_shortname: type_shortname,
|
||||||
type_name,
|
effect_type_name: type_name,
|
||||||
entries: entries.into_bump_slice(),
|
entries: entries.into_bump_slice(),
|
||||||
},
|
},
|
||||||
state,
|
state,
|
||||||
|
|
|
@ -2514,8 +2514,9 @@ mod test_parse {
|
||||||
};
|
};
|
||||||
let arena = Bump::new();
|
let arena = Bump::new();
|
||||||
let effects = Effects {
|
let effects = Effects {
|
||||||
type_name: "Blah",
|
effect_type_name: "Blah",
|
||||||
entries: Vec::new_in(&arena),
|
effect_shortname: "fx",
|
||||||
|
entries: &[],
|
||||||
spaces_before_effects_keyword: &[],
|
spaces_before_effects_keyword: &[],
|
||||||
spaces_after_effects_keyword: &[],
|
spaces_after_effects_keyword: &[],
|
||||||
spaces_after_type_name: &[],
|
spaces_after_type_name: &[],
|
||||||
|
@ -2541,7 +2542,7 @@ mod test_parse {
|
||||||
after_provides: &[],
|
after_provides: &[],
|
||||||
};
|
};
|
||||||
|
|
||||||
let src = "platform rtfeldman/blah requires {} exposes [] packages {} imports [] provides [] effects Blah {}";
|
let src = "platform rtfeldman/blah requires {} exposes [] packages {} imports [] provides [] effects fx.Blah {}";
|
||||||
let actual = platform_header()
|
let actual = platform_header()
|
||||||
.parse(&arena, State::new(src.as_bytes(), Attempting::Module))
|
.parse(&arena, State::new(src.as_bytes(), Attempting::Module))
|
||||||
.map(|tuple| tuple.0);
|
.map(|tuple| tuple.0);
|
||||||
|
@ -2571,8 +2572,9 @@ mod test_parse {
|
||||||
let provide_entry = Located::new(5, 5, 15, 26, Exposed("mainForHost"));
|
let provide_entry = Located::new(5, 5, 15, 26, Exposed("mainForHost"));
|
||||||
let provides = bumpalo::vec![in &arena; provide_entry];
|
let provides = bumpalo::vec![in &arena; provide_entry];
|
||||||
let effects = Effects {
|
let effects = Effects {
|
||||||
type_name: "Effect",
|
effect_type_name: "Effect",
|
||||||
entries: Vec::new_in(&arena),
|
effect_shortname: "fx",
|
||||||
|
entries: &[],
|
||||||
spaces_before_effects_keyword: newlines,
|
spaces_before_effects_keyword: newlines,
|
||||||
spaces_after_effects_keyword: &[],
|
spaces_after_effects_keyword: &[],
|
||||||
spaces_after_type_name: &[],
|
spaces_after_type_name: &[],
|
||||||
|
@ -2606,7 +2608,7 @@ mod test_parse {
|
||||||
packages { foo: "./foo" }
|
packages { foo: "./foo" }
|
||||||
imports []
|
imports []
|
||||||
provides [ mainForHost ]
|
provides [ mainForHost ]
|
||||||
effects Effect {}
|
effects fx.Effect {}
|
||||||
"#
|
"#
|
||||||
);
|
);
|
||||||
let actual = platform_header()
|
let actual = platform_header()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue