tschrijv / AutBound

Code voor Abstract Syntax Tree Code Generator for Haskell-based Com- and Transpilers
1 stars 0 forks source link

xyzshiftplus and xyzshiftminus are erroneously generated for sorts not containing variable bindings #1

Closed VonTum closed 4 years ago

VonTum commented 4 years ago

xyzshiftplus and xyzshiftminus are erroneously generated for sorts not containing variable bindings. While the functions they depend on, xyzshiftplusHelp, xyzshiftminusHelp, and xyzmap do not get generated. This generates a non compiling haskell file.

Example:

sort Term
    | BaseT
    | FuncT (f: Term) (a: Term)

yields

BugBase.hs:16:22: error:
    Variable not in scope: termmap :: Variable -> t1 -> t

BugBase.hs:18:23: error:
    Variable not in scope: termmap :: Variable -> t1 -> t

Adding a namespace and a context does not solve the error, only once a Constructor with a variable is defined are the necessary functions generated, as it should be.

namespace VarTerm: Term

sort Term
    inh ctx VarTerm
    | VarT (x@ctx)
    | BaseT
    | FuncT (f: Term) (a: Term)

Compiles correctly