coalton-lang / coalton

Coalton is an efficient, statically typed functional programming language that supercharges Common Lisp.
https://coalton-lang.github.io/
MIT License
1.15k stars 70 forks source link

bugfix for `apply-ast-substitution` on `node-lisp` and other pre-inlining changes #1179

Closed amorphedstar closed 3 months ago

amorphedstar commented 3 months ago

apply-ast-substitution would previously return node-lisp nodes unchanged, but if the node captures Coalton variables which must be substituted, then the application will need to generate a node-let wrapping the node-lisp.

The codegen will generate code that violates package locks if node-lisp nodes capture variable names which match existing function names and are then inlined into other packages. Accordingly, I renamed some arguments in slice.lisp and vector.lisp.

The codegen-let recursive data constructor requires node-direct-applications, but didn't explicitly check for them, which caused errors when inlining.

There are also a few other minor cleanup changes from browsing through the code.