Merge branch 'main' into module-params

This commit is contained in:
Agus Zubiaga 2024-01-27 09:36:20 -03:00
commit eb68bf943a
No known key found for this signature in database
159 changed files with 5937 additions and 22739 deletions

View file

@ -2224,7 +2224,9 @@ fn update<'a>(
#[cfg(target_family = "wasm")]
{
panic!("Specifying packages via URLs is curently unsupported in wasm.");
panic!(
"Specifying packages via URLs is currently unsupported in wasm."
);
}
} else {
// This wasn't a URL, so it must be a filesystem path.
@ -4079,7 +4081,7 @@ fn load_packages<'a>(
#[cfg(target_family = "wasm")]
{
panic!("Specifying packages via URLs is curently unsupported in wasm.");
panic!("Specifying packages via URLs is currently unsupported in wasm.");
}
} else {
cwd.join(src)

View file

@ -0,0 +1,22 @@
fn report_missing_package_shorthand2<'a>(
packages: &[Loc<PackageEntry>],
imports: &[Loc<ImportsEntry>],
) -> Option<LoadingProblem<'a>> {
imports.iter().find_map(|i| match i.value {
ImportsEntry::Module(_, _) | ImportsEntry::IngestedFile(_, _) => None,
ImportsEntry::Package(shorthand, name, _) => {
let name=name.as_str();
if packages
.iter()
.find(|p| p.value.shorthand == shorthand)
.is_none()
{
Some(
LoadingProblem::FormattedReport(
format!("The package shorthand '{shorthand}' that you are importing the module '{name}' from in '{shorthand}.{name}', doesn't exist in this module.\nImport it in the \"packages\" section of the header.")))
} else {
None
}
}
})
}

View file

@ -1222,7 +1222,6 @@ fn module_cyclic_import_itself() {
err
);
}
#[test]
fn module_cyclic_import_transitive() {
let modules = vec![