Skip to content

Absolute paths in error messages for missing arguments #67

@benjamingeer

Description

@benjamingeer

Given a Fennel program like this:

(λ foo [bar] (print bar))
(foo :bar)

Nfnl compiles the code to produce this Lua program:

-- [nfnl] test.fnl
local function foo(bar)
  if (nil == bar) then
    _G.error("Missing argument bar on /home/ben/test/test.fnl:1", 2)
  else
  end
  return print(bar)
end
return foo("bar")

If I understand correctly, the absolute path is there because of fecf731. The problem is that if I commit this Lua file to a git repository, and someone else clones the repository, the error message will probably be incorrect on their machine. Even on my machine, if I move the Lua file to some other directory (e.g. /usr/local/bin), the error message will be incorrect.

If I compile the file manually with fennel --compile test.fnl > test.lua, I get:

local function foo(bar)
  if (nil == bar) then
    _G.error("Missing argument bar on test.fnl:1", 2)
  else
  end
  return print(bar)
end
return foo("bar")

Could Nfnl please do this instead?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompilerIssues originating upstream in the Fennel compiler.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions