You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error is similar to #10181, but it still reproduced with #10597 so I'm creating a dedicated issue.
Running the formatter on the code:
defexecute(foo ="foo", bar ="bar")
pp(foo: foo bar: bar)
end
execute
Produces the error (I ran it with compiled compiler for the backtrace):
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:5022:9 in 'check'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:2880:9 in 'finish_args'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:2721:9 in 'visit'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:20:7 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:4684:24 in 'indent'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:4708:7 in 'write_indent'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:1397:13 in 'format_nested'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:1388:5 in 'format_nested:write_end_line'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:1424:7 in 'format_nested_with_end'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:1409:5 in 'format_nested_with_end'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:1493:9 in 'visit'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:20:7 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:4684:24 in 'indent'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:262:11 in 'visit'
from /home/george/dev/git/crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:16:7 in 'format'
from /home/george/dev/git/crystal/src/compiler/crystal/tools/formatter.cr:5:5 in 'format'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:159:7 in 'format'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:127:16 in 'format_source'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:123:7 in 'format_file'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:110:11 in 'format_file_or_directory'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:103:9 in 'format_many'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:92:9 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal/command/format.cr:53:5 in 'format'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:160:7 in 'tool'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:108:7 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:49:5 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal/command.cr:48:3 in 'run'
from /home/george/dev/git/crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
from /home/george/dev/git/crystal/src/crystal/main.cr:110:5 in 'main_user_code'
from /home/george/dev/git/crystal/src/crystal/main.cr:96:7 in 'main'
from /home/george/dev/git/crystal/src/crystal/main.cr:119:3 in 'main'
from __libc_start_main
from _start
from ???
What's also interesting is that the example code actually compiles fine.
The text was updated successfully, but these errors were encountered:
The fact that the example compiles reveales a more general parser bug: A call is incorrectly identified as reading from a local variable if such exists, even with a named argument (and no parenthesis).
The following code is a minimal reproduction:
foo =1
foo b:1
The parser entirely skips the named argument. And that actually causes the formatter to error because it traverses the AST and source input in sync and that doesn't line up when the AST presents a var but the source moves on to the named argument.
Error is similar to #10181, but it still reproduced with #10597 so I'm creating a dedicated issue.
Running the formatter on the code:
Produces the error (I ran it with compiled compiler for the backtrace):
What's also interesting is that the example code actually compiles fine.
The text was updated successfully, but these errors were encountered: