Comment by ~rktjmp on ~technomancy/fennel
Reproduction, observe "--WARNING" output written to stderr in the terminal.
(let [{: compile-string} (require :fennel)] (compile-string "(local x\"bad\")" {:warn #(print "warnings are just suggestions")}))
Ticket created by ~rktjmp on ~technomancy/fennel
The (currently undocumented)
warn
compiler option, used to redirect stderr messages to a custom function is not used when callingcompile-string
(and assumedly othercompile-*
functions).Fennels internal
warn
function checksroot.options
which isnil
, so it always falls back tostderr
.
Comment by ~rktjmp on ~technomancy/fennel
It also does not work in case/match/case-try/case-match.
;; per tests, working (let [[a b & c &as t] [1 2 3 4 5]] [a b c t]) (case [1 2 3 4 5] ;; expected & rest argument before last parameter [a b & c &as t] [a b c t])
Ticket created by ~rktjmp on ~xerool/fennel-ls
Not sure how you feel about this one, it's different to https://todo.sr.ht/~xerool/fennel-ls/23 (
[a a]
==(= a1 a2)
)The following,
(case x [any-non-nil] (do ...)))gives an
unused definition
warning, but the existence of a binding is usage, its implicitly checking for non-nil.
Ticket created by ~rktjmp on ~xerool/fennel-ls
(case [1 1] [a a] true ;; unused definition: a _ false)
a
is implicitly used when checking that both elements are equal.
Ticket created by ~rktjmp on ~xerool/fennel-ls
;; given the same binding name, the second `n` is marked as unused. (case [:a 1] (where (or [:a n] [:b n])) n _ false) ;; ./fennel-ls --check bug/case-undef.fnl ;; bug/case-undef.fnl:2:24 unused definition: n
Ticket created by ~rktjmp on ~technomancy/fennel
If the accumulator name given to
accumulate
is the same as the binding given to the iterator function, the accumulators initial value is passed to the iterator instead.Not sure if this is an issue, or an intended quirk allowing you to define the iterator target in accumulates bindings.
Eg given:
(let [x [1 2 3]] (accumulate [x "" _ v (ipairs x)] (.. x v)))We get the lua
local x = {1, 2, 3} local x0 = "" for _, v in ipairs(x0) do -- calls ipairs("") x0 = (x0 .. v) end return x0Instead of (?)
local x = {1, 2, 3} local x0 = "" for _, v in ipairs(x) do -- calls ipairs({1,2,3}) x0 = (x0 .. v) end return x0
Ticket created by ~rktjmp on ~technomancy/fennel
The test suite seems to depend on state from previous tests to pass sometimes.
Run against 85449ab (1.3.0-dev), lua 5.4.2
fex:
make test
-> all passing- Disable all suites in test/init.lua aside from
failures
make test
-> fails to run- Re-enable
core
(socore
+failures
)make test
-> all passingOr a tighter focus:
- Disable all suites but
core
&&failures
intest/init.lua
.- Disable all tests in those suites except
test/core#test-nest
&&test/failures#test-suggestions
make test
-> 2/2 tests passing- Disable
test/core#test-nest
make test
-> test failsPreviously:
The compiler plugin used in
failures#test-macro-traces
would be retained in subsequent tests until one of therepl
tests seemed to unintentionally remove it, see https://github.com/bakpakin/Fennel/pull/427#issuecomment-1138286136(The compiler plugin test currently includes a work-around via an internal guard to only intentionally fail once.)
Ticket created by ~rktjmp on ~technomancy/fennel
#(do #(values $...))Compile error: use $... in hashfn
Non vargs are ok:
#(do #(values $1))local function _1_() local function _2_(_2410) return _2410 end return _2_ end return _1_
Ticket created by ~rktjmp on ~technomancy/fennel
(macro wont-output-body [] ;; let also fails to output (local body [`(do (+ 1 1) (values 1)) `(do (+ 2 2) (values 2))]) `(fn [] ,body (values :val))) (macro will-output-body [] (local body [`(do (+ 1 1) (values 1)) `(do (+ 2 2) (values 2))]) `(fn [] nil ;; can be any expression ,body ;; (do ,body) also works (values :val))) (comment the following WONT output body statements) (wont-output-body) (comment the following WILL output body statements) (will-output-body) (macro just-body [] (local body [`(do (+ 1 1) (values 1)) `(do (+ 2 2) (values 2))]) body) (comment otherwise this normally works) (just-body)--[[ the following WONT output body statements ]] local function _1_() return "val" end --[[ the following WILL output body statements ]] local function _2_() local _3_ do do local _ = (1 + 1) end _3_ = 1 end local function _4_() do local _ = (2 + 2) end return 2 end do local _ = {_3_, _4_()} end return "val" end --[[ otherwise this normally works ]] local _5_ do do local _ = (1 + 1) end _5_ = 1 end local function _6_(...) do local _ = (2 + 2) end return 2 end return {_5_, _6_(...)}