Skip to content

Commit ffda182

Browse files
committed
correctly format reqs
1 parent d3c12f8 commit ffda182

File tree

1 file changed

+19
-8
lines changed
  • crates/compilers/src/resolver

1 file changed

+19
-8
lines changed

crates/compilers/src/resolver/mod.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,18 +556,19 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
556556
/// path/to/c.sol (<version>)
557557
/// ...
558558
/// ```
559-
fn format_imports_list<W: std::fmt::Write>(
559+
fn format_imports_list<C: Compiler, T: ArtifactOutput, W: std::fmt::Write>(
560560
&self,
561561
idx: usize,
562562
incompatible: HashSet<usize>,
563+
project: &Project<C, T>,
563564
f: &mut W,
564565
) -> std::result::Result<(), std::fmt::Error> {
565566
let format_node = |idx, f: &mut W| {
566567
let node = self.node(idx);
567568
let color = if incompatible.contains(&idx) { Color::Red } else { Color::White };
568569

569570
let mut line = utils::source_name(&node.path, &self.root).display().to_string();
570-
if let Some(req) = node.data.version_req() {
571+
if let Some(req) = self.version_requirement(idx, project) {
571572
line.push_str(&format!(" {req}"));
572573
}
573574

@@ -683,15 +684,20 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
683684
if self.check_available_version(*node, &all_versions, project).is_err() {
684685
let mut msg = "Found incompatible versions:\n".white().to_string();
685686

686-
self.format_imports_list(idx, [*node, failed_node_idx].into(), &mut msg)
687-
.unwrap();
687+
self.format_imports_list(
688+
idx,
689+
[*node, failed_node_idx].into(),
690+
project,
691+
&mut msg,
692+
)
693+
.unwrap();
688694
return Err(msg);
689695
}
690696
}
691697
}
692698

693699
let mut msg = "Found incompatible versions:\n".white().to_string();
694-
self.format_imports_list(idx, nodes.into_iter().collect(), &mut msg).unwrap();
700+
self.format_imports_list(idx, nodes.into_iter().collect(), project, &mut msg).unwrap();
695701
Err(msg)
696702
}
697703

@@ -744,15 +750,20 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
744750
{
745751
let mut msg = "Found incompatible settings restrictions:\n".white().to_string();
746752

747-
self.format_imports_list(idx, [*node, failed_node_idx].into(), &mut msg)
748-
.unwrap();
753+
self.format_imports_list(
754+
idx,
755+
[*node, failed_node_idx].into(),
756+
project,
757+
&mut msg,
758+
)
759+
.unwrap();
749760
return Err(msg);
750761
}
751762
}
752763
}
753764

754765
let mut msg = "Found incompatible settings restrictions:\n".white().to_string();
755-
self.format_imports_list(idx, nodes.into_iter().collect(), &mut msg).unwrap();
766+
self.format_imports_list(idx, nodes.into_iter().collect(), project, &mut msg).unwrap();
756767
Err(msg)
757768
}
758769

0 commit comments

Comments
 (0)