Skip to content

Commit

Permalink
Merge 90e87e0 into d6f60d7
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored Sep 10, 2024
2 parents d6f60d7 + 90e87e0 commit 164b52a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions compiler/noirc_frontend/src/parser/errors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::ast::{Expression, IntegerBitSize};
use crate::lexer::errors::LexerErrorKind;
use crate::lexer::token::Token;
use crate::token::TokenKind;
use small_ord_set::SmallOrdSet;
use thiserror::Error;

Expand Down Expand Up @@ -211,8 +212,17 @@ impl<'a> From<&'a ParserError> for Diagnostic {
other => Diagnostic::simple_error(format!("{other}"), String::new(), error.span),
},
None => {
let primary = error.to_string();
Diagnostic::simple_error(primary, String::new(), error.span)
if matches!(
error.found.kind(),
TokenKind::InnerDocComment | TokenKind::OuterDocComment
) {
let primary = "This doc comment doesn't document anything".to_string();
let secondary = "Consider changing it to a regular `//` comment".to_string();
Diagnostic::simple_error(primary, secondary, error.span)
} else {
let primary = error.to_string();
Diagnostic::simple_error(primary, String::new(), error.span)
}
}
}
}
Expand Down

0 comments on commit 164b52a

Please sign in to comment.