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

Tests for relative precedence of $ and := #569

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions testsuite/bsc.syntax/bh/DollarColonEqualsPrecedence1.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package DollarColonEqualsPrecedence1 where

foo :: Reg Bool -> Reg Bool
foo = id

bar :: Reg Bool -> Action
bar r = foo $ r := False

8 changes: 8 additions & 0 deletions testsuite/bsc.syntax/bh/DollarColonEqualsPrecedence2.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package DollarColonEqualsPrecedence2 where

foo :: Action -> Action
foo = id

bar :: Reg Bool -> Action
bar r = foo $ r := False

8 changes: 8 additions & 0 deletions testsuite/bsc.syntax/bh/DollarColonEqualsPrecedence3.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package DollarColonEqualsPrecedence3 where

foo :: Bool -> Bool
foo = id

bar :: Reg Bool -> Action
bar r = r := foo $ False

6 changes: 6 additions & 0 deletions testsuite/bsc.syntax/bh/bh.exp
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,9 @@ compare_file [make_bsc_output_name NiceType.bs]
compile_fail_error DanglingDecimal.bs P0005
compile_fail_error FieldSelectionWithDigit.bs P0005
compile_fail_error FieldSelectionFromDigit.bs T0031

# Tests for relative precedence of $ and := (see github discussion #587)
compile_fail_error DollarColonEqualsPrecedence1.bs T0080
compile_pass DollarColonEqualsPrecedence2.bs
compile_fail_error DollarColonEqualsPrecedence3.bs T0083

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package DollarColonEqualsPrecedencePretty1 where

foo :: Reg Bool -> Reg Bool
foo = id

bar :: Reg Bool -> Action
bar r = (foo $ r) := False

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package DollarColonEqualsPrecedencePretty2 where

foo :: Action -> Action
foo = id

bar :: Reg Bool -> Action
bar r = foo $ (r := False)

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package DollarColonEqualsPrecedencePretty3 where

foo :: Bool -> Bool
foo = id

bar :: Reg Bool -> Action
bar r = r := (foo $ False)

7 changes: 7 additions & 0 deletions testsuite/bsc.syntax/bh_parse_pretty/bh-parse-pretty.exp
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ proc compile_ppp_pass_bug { source {bug ""} {options ""}} {

# let bindings (GitHub Issue #529)
compile_ppp_pass Let.bs

# tests for pretty-printing relative precedence of $ and := (github issue #568)
# see also github discussion #587 for context
compile_ppp_pass_bug DollarColonEqualsPrecedencePretty1.bs "github#568"
compile_ppp_pass DollarColonEqualsPrecedencePretty2.bs
compile_ppp_pass_bug DollarColonEqualsPrecedencePretty3.bs "github#568"