Skip to content

Commit

Permalink
Merge pull request #655 from mieszko/uppercase-arg-names
Browse files Browse the repository at this point in the history
allow any unqualified classic identifier in interface `arg_names`
  • Loading branch information
mieszko committed Dec 26, 2023
2 parents d06bdc5 + 9e66ab2 commit cf4dcee
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/comp/Parser/Classic/CParser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ prefix = literal (mkFString "prefixs") ||| literal (mkFString "prefix")
pIfcPragmas :: CParser [IfcPragma]
pIfcPragmas =
-- arg_name = [id,id]
literal (mkFString "arg_names") ..+ eq ..+ lb ..+ pFieldId `sepBy` cm +.. rb `into`
literal (mkFString "arg_names") ..+ eq ..+ lb ..+ varcon `sepBy` cm +.. rb `into`
(\a -> succeed $ [(PIArgNames a)])
-- prefix = "str"
||! prefix ..+ eq ..+ varString
Expand Down
8 changes: 8 additions & 0 deletions testsuite/bsc.syntax/bh/IfcArgNamesLower.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package IfcArgNamesLower where

interface Foo =
foo :: Bool -> Action {-# arg_names = [foobar] #-}

{-# synthesize mkFoo #-}
mkFoo :: Module Foo
mkFoo = return _
8 changes: 8 additions & 0 deletions testsuite/bsc.syntax/bh/IfcArgNamesQual.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package IfcArgNamesQual where

interface Foo =
foo :: Bool -> Action {-# arg_names = [FOO.bar] #-}

{-# synthesize mkFoo #-}
mkFoo :: Module Foo
mkFoo = return _
8 changes: 8 additions & 0 deletions testsuite/bsc.syntax/bh/IfcArgNamesUpper.bs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package IfcArgNamesUpper where

interface Foo =
foo :: Bool -> Action {-# arg_names = [FOOBAR] #-}

{-# synthesize mkFoo #-}
mkFoo :: Module Foo
mkFoo = return _
6 changes: 6 additions & 0 deletions testsuite/bsc.syntax/bh/bh.exp
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,9 @@ compile_fail_error DegreePrimeVar1.bs P0005
compile_fail_error DegreePrimeVar2.bs P0005
compile_fail_error DegreePrimeVar3.bs P0005
compile_fail_error DegreePrimeVar4.bs P0005

# Test for the arg_names interface method property
compile_pass IfcArgNamesLower.bs
compile_pass IfcArgNamesUpper.bs
compile_fail_error IfcArgNamesQual.bs P0005

0 comments on commit cf4dcee

Please sign in to comment.