Skip to content

Commit

Permalink
add a warning if the old-style of pos is written
Browse files Browse the repository at this point in the history
  • Loading branch information
EclecticGriffin committed Jan 13, 2025
1 parent b647c7f commit 000dca3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions calyx-frontend/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ impl FromStr for Attribute {
if DEPRECATED_ATTRIBUTES.contains(&s) {
log::warn!("The attribute @{s} is deprecated and will be ignored by the compiler.");
}

if let Ok(SetAttribute::Set(_)) = SetAttribute::from_str(s) {
log::warn!("Set attribute {s} incorrectly written as a standard attribute, i.e. '@{s}(..)' or '\"{s}\" = ..'. This will be ignored by the compiler. Instead write '@{s}{{..}}' or '\"{s}\" = {{..}}'.");
}

// Reject attributes that all caps since those are reserved for internal attributes
if s.to_uppercase() == s {
return Err(Error::misc(format!("Invalid attribute: {}. All caps attributes are reserved for internal use.", s)));
Expand Down

0 comments on commit 000dca3

Please sign in to comment.