Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correctly print string tokens #6021

Merged
merged 1 commit into from
Sep 12, 2024
Merged
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: 3 additions & 3 deletions compiler/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@
Token::Ident(ref s) => write!(f, "{s}"),
Token::Int(n) => write!(f, "{}", n.to_u128()),
Token::Bool(b) => write!(f, "{b}"),
Token::Str(ref b) => write!(f, "{b}"),
Token::FmtStr(ref b) => write!(f, "f{b}"),
Token::Str(ref b) => write!(f, "{b:?}"),
Token::FmtStr(ref b) => write!(f, "f{b:?}"),
Token::RawStr(ref b, hashes) => {
let h: String = std::iter::once('#').cycle().take(hashes as usize).collect();
write!(f, "r{h}\"{b}\"{h}")
write!(f, "r{h}{b:?}{h}")
}
Token::Keyword(k) => write!(f, "{k}"),
Token::Attribute(ref a) => write!(f, "{a}"),
Expand Down Expand Up @@ -799,7 +799,7 @@
["varargs"] => Attribute::Secondary(SecondaryAttribute::Varargs),
tokens => {
tokens.iter().try_for_each(|token| validate(token))?;
Attribute::Secondary(SecondaryAttribute::Custom(CustomAtrribute {

Check warning on line 802 in compiler/noirc_frontend/src/lexer/token.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Atrribute)
contents: word.to_owned(),
span,
contents_span,
Expand Down Expand Up @@ -896,7 +896,7 @@
ContractLibraryMethod,
Export,
Field(String),
Custom(CustomAtrribute),

Check warning on line 899 in compiler/noirc_frontend/src/lexer/token.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Atrribute)
Abi(String),

/// A variable-argument comptime function.
Expand All @@ -904,7 +904,7 @@
}

#[derive(PartialEq, Eq, Hash, Debug, Clone, PartialOrd, Ord)]
pub struct CustomAtrribute {

Check warning on line 907 in compiler/noirc_frontend/src/lexer/token.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Atrribute)
pub contents: String,
// The span of the entire attribute, including leading `#[` and trailing `]`
pub span: Span,
Expand All @@ -913,7 +913,7 @@
}

impl SecondaryAttribute {
pub(crate) fn as_custom(&self) -> Option<&CustomAtrribute> {

Check warning on line 916 in compiler/noirc_frontend/src/lexer/token.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (Atrribute)
if let Self::Custom(attribute) = self {
Some(attribute)
} else {
Expand Down
Loading