You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inspection shows that this is because PrintProg.hs defines type Doc = [ShowS] -> [ShowS]. Other modules similarly define types, such as Err and ParseFun. Since the AbsProg.hs file is not imported with a qualified import, there is a namespace conflict.
Perhaps it would be sensible to either supply a list of reserved class names and report the use of them when generating the frontend files, or use qualified imports to avoid namespace conflicts.
The text was updated successfully, but these errors were encountered:
Indeed, the Abs modules should be imported qualified. Note that you can also get the error if you use some Haskell built-in type such as Int.
If you look in module BNFC.Backend.Haskell.CFtoPrinter,
you can see that the name of the AST module, absMod, is only passed to prologue. To get qualified references, it should be passed to all subroutines, preferably as the state of some Reader monad to get all subroutines access to the configuration of the printer generation. All uses of Show Cat should then be replaced to produce qualified references to the AST types.
Steps to reproduce:
Prog.cf
)bnfc -m Prog.cf
make
Output: make.log
Other class names that causes the same error:
Err
ParseFun
Inspection shows that this is because
PrintProg.hs
definestype Doc = [ShowS] -> [ShowS]
. Other modules similarly define types, such asErr
andParseFun
. Since theAbsProg.hs
file is not imported with a qualified import, there is a namespace conflict.Perhaps it would be sensible to either supply a list of reserved class names and report the use of them when generating the frontend files, or use qualified imports to avoid namespace conflicts.
The text was updated successfully, but these errors were encountered: