~technomancy/fennel#159: 
Incorrect "one body" error form with certain indentation

These errors are reproducible with {f}accumulate and icollect.

Using if-style indentation, the wrong form is blamed when two lists are provided as body to `faccumulate:

(if
  1 (faccumulate [_ []
                 _ _ (ipairs [])]
      (when nil nil)
      (table.insert acc frm)))

./fennel --compile reprod.fnl
reprod.fnl:2:4 Compile error: src/fennel/macros.fnl:176: expected exactly one body expression. Wrap multiple expressions with do

  1

When evaluated by itself, there is no form printed when providing two lists as body:

(faccumulate [_ []
              _ _ (ipairs [])]
  (when nil nil)
  (table.insert acc frm))

./fennel --compile reprod.fnl
reprod.fnl:1:0 Compile error: src/fennel/macros.fnl:176: expected exactly one body expression. Wrap multiple expressions with do


Status
RESOLVED FIXED
Submitter
~ambrosebs
Assigned to
No-one
Submitted
1 year, 1 month ago
Updated
1 year, 30 days ago
Labels
No labels applied.

~technomancy REPORTED FIXED 1 year, 30 days ago

Good catch! In fact, the bug is the same in both cases: the pinpointed form is simply not printed.

In the first case, it looks like the wrong form is pinpointed, but it's actually just displaying the part of the line which comes before the pinpointed section. This was due to an issue where the beginning of the pinpointed form and its end were not found on the same line.

Should be fixed in 0f03595.

Register here or Log in to comment, or comment via email.