Crystal: Macros: ending comma incorrectly required in multi-line arguments

Created on 19 Apr 2018  路  1Comment  路  Source: crystal-lang/crystal

This following code fails without a comma after a = 0.
When we add the missing comma, running the formatter crystal tool format removes it (tested in master):

macro test(
  a = 0
)
end

Syntax error in test.cr:2: unexpected token: NEWLINE (expected ',' or ')')

No problems when not setting defaut values for arguments, or all arguments is in one line.

There are two options:

  1. keep a similar behavior as def - make macro works without an ending comma.
  2. enforce an ending comma
bug compiler topicparser

Most helpful comment

IMO only option no. 1 seems legit.

>All comments

IMO only option no. 1 seems legit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cjgajard picture cjgajard  路  3Comments

oprypin picture oprypin  路  3Comments

asterite picture asterite  路  3Comments

jhass picture jhass  路  3Comments

TechMagister picture TechMagister  路  3Comments