Merge branch 'main' into typecheck-module-params

This commit is contained in:
Agus Zubiaga 2024-08-07 18:55:33 -03:00
commit 762799052e
No known key found for this signature in database
600 changed files with 30337 additions and 17782 deletions

View file

@ -465,7 +465,8 @@ fn contains_unexposed_type(
while let Some(field) = fields_to_process.pop() {
match field {
AssignedField::RequiredValue(_field, _spaces, loc_val)
| AssignedField::OptionalValue(_field, _spaces, loc_val) => {
| AssignedField::OptionalValue(_field, _spaces, loc_val)
| AssignedField::IgnoredValue(_field, _spaces, loc_val) => {
if contains_unexposed_type(&loc_val.value, exposed_module_ids, module_ids) {
return true;
}
@ -721,7 +722,7 @@ fn record_field_to_doc(
AssignedField::LabelOnly(label) => Some(RecordField::LabelOnly {
name: label.value.to_string(),
}),
AssignedField::Malformed(_) => None,
AssignedField::Malformed(_) | AssignedField::IgnoredValue(_, _, _) => None,
}
}

View file

@ -2993,8 +2993,10 @@ fn update<'a>(
fn register_package_shorthands<'a>(
shorthands: &mut MutMap<&'a str, ShorthandPath>,
package_entries: &MutMap<&'a str, header::PackageName<'a>>,
#[allow(unused_variables)] // for wasm
module_path: &Path,
src_dir: &Path,
#[allow(unused_variables)] // for wasm
cache_dir: &Path,
) -> Result<(), LoadingProblem<'a>> {
for (shorthand, package_name) in package_entries.iter() {
@ -3607,9 +3609,9 @@ fn load_module<'a>(
macro_rules! load_builtins {
($($name:literal, $module_id:path)*) => {
match module_name.as_inner().as_str() {
match module_name.unqualified().map(|name| name.as_str()) {
$(
$name => {
Some($name) => {
let (module_id, msg) = load_builtin_module(
arena,
module_ids,
@ -3658,6 +3660,8 @@ fn load_module<'a>(
#[derive(Debug)]
enum ShorthandPath {
/// e.g. "/home/rtfeldman/.cache/roc/0.1.0/oUkxSOI9zFGtSoIaMB40QPdrXphr1p1780eiui2iO9Mz"
#[allow(dead_code)]
// wasm warns FromHttpsUrl is unused, but errors if it is removed ¯\_(ツ)_/¯
FromHttpsUrl {
/// e.g. "/home/rtfeldman/.cache/roc/0.1.0/oUkxSOI9zFGtSoIaMB40QPdrXphr1p1780eiui2iO9Mz"
root_module_dir: PathBuf,
@ -4069,6 +4073,7 @@ fn load_packages<'a>(
app_module_id: Option<ModuleId>,
module_ids: Arc<Mutex<PackageModuleIds<'a>>>,
ident_ids_by_module: SharedIdentIdsByModule,
#[allow(unused_variables)] // for wasm
filename: PathBuf,
) {
// Load all the packages
@ -4959,6 +4964,7 @@ fn build_platform_header<'a>(
.zip(requires.iter().copied()),
arena,
);
let packages = unspace(arena, header.packages.item.items);
let exposes = bumpalo::collections::Vec::from_iter_in(
unspace(arena, header.exposes.item.items).iter().copied(),
arena,
@ -4980,7 +4986,7 @@ fn build_platform_header<'a>(
filename,
is_root_module,
opt_shorthand,
packages: &[],
packages,
header_type,
module_comments: comments,
header_imports: Some(header.imports),

View file

@ -882,7 +882,7 @@ fn platform_parse_error() {
match multiple_modules("platform_parse_error", modules) {
Err(report) => {
assert!(report.contains("NOT END OF FILE"));
assert!(report.contains("STATEMENT AFTER EXPRESSION"));
assert!(report.contains("blah 1 2 3 # causing a parse error on purpose"));
}
Ok(_) => unreachable!("we expect failure here"),
@ -2151,7 +2151,7 @@ fn roc_file_no_extension() {
indoc!(
r#"
app "helloWorld"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.10.0/vNe6s9hWzoTZtFmNkvEICPErI9ptji_ySjicO6CkucY.tar.br" }
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.12.0/Lb8EgiejTUzbggO2HVVuPJFkwvvsfW6LojkLR20kTVE.tar.br" }
imports [pf.Stdout]
provides [main] to pf