Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomocavalieri committed Oct 6, 2024
1 parent 2d42bf5 commit 8b7e802
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler-core/src/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ mod tests {

#[test]
fn resolution_error_message() {
let result = resolve_versions(
let _ = resolve_versions(
interesting_remote(),
HashMap::new(),
"app".into(),
Expand Down
15 changes: 13 additions & 2 deletions compiler-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use heck::{ToSnakeCase, ToTitleCase, ToUpperCamelCase};
use hexpm::version::ResolutionError;
use itertools::Itertools;
use pubgrub::package::Package;
use pubgrub::range::Range;
use pubgrub::report::{DerivationTree, Derived, External};
use pubgrub::version::Version;
use std::collections::HashSet;
Expand Down Expand Up @@ -411,6 +412,10 @@ fn derivation_tree_to_pretty_error_message(
) -> String {
derivation_tree.collapse_no_versions();
let derivation_tree = simplify_error(derivation_tree);

// TODO))
// This order is not deterministic, so sometimes it will default to the
// original version even though it's almost the same!!
match &derivation_tree {
DerivationTree::Derived(Derived { cause1, cause2, .. }) => {
match (cause1.as_ref(), cause2.as_ref()) {
Expand Down Expand Up @@ -442,14 +447,20 @@ fn derivation_tree_to_pretty_error_message(
&& maybe_root_range == root_range
&& maybe_dep == dep =>
{
// TODO))
// The default look of ranges is confusing and we want to switch
// to one more similar to Gleam's constraints.
// However, at the moment there's no way of doing this:
// https://github.com/pubgrub-rs/pubgrub/issues/258
//
wrap_format!(
"Unable to find compatible versions for the version \
constraints in your gleam.toml.
constraints in your gleam.toml:
- `{root}` requires `{common}` to be `{common_range}`
- and all versions of `{common}` in that range require `{dep}` to be `{dep_range_from_common}`
- but `{root}` also requires `{dep}` to be `{dep_range_from_root}`
- and there is no version of `{dep}` that satiesfies both constraints
- and there is no version of `{dep}` that satisfies both constraints
"
)
}
Expand Down

0 comments on commit 8b7e802

Please # to comment.