Skip to content

Commit

Permalink
Merge pull request #1574 from DanielXMoore/amp-type-postfix
Browse files Browse the repository at this point in the history
Fix parenthesized `&` followed by type postfix
  • Loading branch information
edemaine authored Nov 4, 2024
2 parents 614de96 + 6b23ffb commit 8ae9cf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/parser.hera
Original file line number Diff line number Diff line change
Expand Up @@ -2425,7 +2425,7 @@ FunctionExpression
children: [ open, fn, close ],
expression: fn,
}
OpenParen:open __:ws1 !/\+\+|--|[\+\-&]\S/ BinaryOp:op __:ws2 NonPipelineAssignmentExpression:rhs CloseParen:close ->
OpenParen:open __:ws1 !/\+\+|--|[\+\-&]\S/ !( Placeholder TypePostfix ) BinaryOp:op __:ws2 NonPipelineAssignmentExpression:rhs CloseParen:close ->
const refA = makeRef("a")
const fn = makeAmpersandFunction({
ref: refA,
Expand Down
8 changes: 8 additions & 0 deletions test/function-block-shorthand.civet
Original file line number Diff line number Diff line change
Expand Up @@ -1105,3 +1105,11 @@ describe "operator sections", ->
---
const callback = (b => sum += /*num*/b)
"""

testCase """
& not left section
---
(& as number) + 1
---
$ => ($ as number) + 1
"""

0 comments on commit 8ae9cf3

Please sign in to comment.