Skip to content

Commit

Permalink
Merge branch 'evantypanski:topic/etyp/convert-dd'
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Nov 4, 2024
2 parents a04cced + fd763af commit 038acb0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions rule-tests/use-dd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ valid:
- "type X = unit { x: uint8 { $$; } };"
- "type X = unit { x: uint8 { other.y; } };"
- "type X = unit { y: uint8 { self.x; } };"
- "type X = unit { x: uint8 &convert=$$ + 5 { self.x; $$; } };"
invalid:
- "type X = unit { x: uint8 { self.x; } };"
- "type X = unit { x: uint8 { if (True) self.x; } };"
7 changes: 7 additions & 0 deletions rules/use-dd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ rule:
field: "name"
kind: "ident"
pattern: "$F"
not:
inside:
kind: "field_decl"
stopBy: "end"
has:
kind: "attribute"
regex: "&convert"

fix: "$$"

Expand Down

0 comments on commit 038acb0

Please # to comment.