Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion compiler/noirc_frontend/src/ast/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,11 @@ impl PathSegment {
///
/// Returns an empty span at the end of `foo` if there's no turbofish.
pub fn turbofish_span(&self) -> Span {
Span::from(self.ident.span().end()..self.location.span.end())
if self.ident.location().file == self.location.file {
Span::from(self.ident.span().end()..self.location.span.end())
} else {
self.location.span
}
}

pub fn turbofish_location(&self) -> Location {
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/resolution/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl<'a> From<&'a ResolverError> for Diagnostic {

let mut diagnostic = Diagnostic::simple_warning(
format!("unused variable {name}"),
"unused variable ".to_string(),
"unused variable".to_string(),
ident.location(),
);
diagnostic.unnecessary = true;
Expand Down
6 changes: 4 additions & 2 deletions compiler/noirc_frontend/src/hir/resolution/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ impl<'a> From<&'a PathResolutionError> for CustomDiagnostic {
CustomDiagnostic::simple_warning(error.to_string(), String::new(), ident.location())
}
PathResolutionError::UnresolvedWithPossibleTraitsToImport { ident, traits } => {
let traits = vecmap(traits, |trait_name| format!("`{}`", trait_name));
let mut traits = vecmap(traits, |trait_name| format!("`{}`", trait_name));
traits.sort();
CustomDiagnostic::simple_error(
error.to_string(),
format!(
Expand All @@ -126,7 +127,8 @@ impl<'a> From<&'a PathResolutionError> for CustomDiagnostic {
)
}
PathResolutionError::MultipleTraitsInScope { ident, traits } => {
let traits = vecmap(traits, |trait_name| format!("`{}`", trait_name));
let mut traits = vecmap(traits, |trait_name| format!("`{}`", trait_name));
traits.sort();
CustomDiagnostic::simple_error(
error.to_string(),
format!(
Expand Down
6 changes: 5 additions & 1 deletion compiler/noirc_frontend/src/parser/parser/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ impl Parser<'_> {
None
};

segments.push(PathSegment { ident, generics, location });
segments.push(PathSegment {
ident,
generics,
location: self.location_since(location),
});

if self.at(Token::DoubleColon)
&& matches!(self.next_token.token(), Token::Ident(..))
Expand Down
Loading
Loading