Skip to content

Commit eb4fa17

Browse files
makenowjustRX14
authored andcommitted
Skip newline after block arg in paren call (#5237)
Fixed #5235
1 parent 074d61c commit eb4fa17

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

spec/compiler/parser/parser_spec.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ describe "Parser" do
337337
it_parses "foo(&.as?(T).bar)", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], Call.new(NilableCast.new(Var.new("__arg0"), "T".path), "bar")))
338338
it_parses "foo &.as?(T)", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], NilableCast.new(Var.new("__arg0"), "T".path)))
339339
it_parses "foo &.as?(T).bar", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], Call.new(NilableCast.new(Var.new("__arg0"), "T".path), "bar")))
340+
it_parses "foo(\n &.block\n)", Call.new(nil, "foo", block: Block.new([Var.new("__arg0")], Call.new(Var.new("__arg0"), "block")))
340341

341342
it_parses "foo.[0]", Call.new("foo".call, "[]", 0.int32)
342343
it_parses "foo.[0] = 1", Call.new("foo".call, "[]=", [0.int32, 1.int32] of ASTNode)

src/compiler/crystal/syntax/parser.cr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,7 @@ module Crystal
14661466
end_location = token_end_location
14671467

14681468
if check_paren
1469+
skip_space_or_newline
14691470
check :")"
14701471
next_token_skip_space
14711472
else

0 commit comments

Comments
 (0)