Olical / aniseed

Neovim configuration and plugins in Fennel (Lisp compiled to Lua)
https://discord.gg/wXAMr8F
The Unlicense
610 stars 28 forks source link

Nested tables in comment form produces error on AniseedEval/AniseedEvalFile #142

Open Kamholtz opened 1 year ago

Kamholtz commented 1 year ago

Problem

Command issued:

:AniseedEval (comment [[ "a"]])

Error message:

runtime error: [string "(local *file* nil)(require-macros "aniseed.ma..."]:2: unexpected symbol near ']'
stack traceback:
  [C]: in function 'assert'
  ...te\pack\packer\start\aniseed/lua/aniseed/deps/fennel.lua:805: in function 'load-code'
  ...te\pack\packer\start\aniseed/lua/aniseed/deps/fennel.lua:5381: in function ?
  [C]: in function 'str'
  ...ata\site\pack\packer\start\aniseed/lua/aniseed/setup.lua:22: in function ?

Similarly:

Command: AniseedEval (comment {1 {1 "a"}})

Error message:

runtime error: [string "(local *file* nil)(require-macros "aniseed.ma..."]:2: unexpected symbol near ']'
stack traceback:
  [C]: in function 'assert'
  ...te\pack\packer\start\aniseed/lua/aniseed/deps/fennel.lua:805: in function 'load-code'
  ...te\pack\packer\start\aniseed/lua/aniseed/deps/fennel.lua:5381: in function ?
  [C]: in function 'str'
  ...ata\site\pack\packer\start\aniseed/lua/aniseed/setup.lua:22: in function ?

Info

I happened to encounter this while using conjure to evaluate a file containing a form like the following:

(comment
  [[ "a"]]
  )

; eval (current-form): (comment [[ "a"]] )
; ...packer\start\conjure/lua/conjure/aniseed/deps/fennel.lua:805: [string "local op__3ereplacement0 = ___replLocals___['..."]:2: unexpected symbol near ']'

But it appears to be a problem in Aniseed too. Both Aniseed and Conjure are the latest release on master.

Olical commented 1 year ago

So I think this is a Fennel bug, if it's fixed upstream I'll update the internal fennel compiler and it should get fixed.

$ fennel
Welcome to Fennel 1.3.0 on PUC Lua 5.4!
Use ,help to see available commands.
Try installing readline via luarocks for a better repl experience.
>> (comment [["a"]])
Bad code generated - likely a bug with the compiler:
--- Generated Lua Start ---
--[[ [["a"]] ]]

return nil--- Generated Lua End ---
Kamholtz commented 1 year ago

Ah so it is. Here's the official issue:

[#128](https://todo.sr.ht/~technomancy/fennel/128)