File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
src/compiler/crystal/syntax Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -2653,6 +2653,13 @@ module Crystal
26532653 assert_end_location " [1, 2,]"
26542654 assert_end_location " foo(\n &.block\n )" , line_number: 3 , column_number: 1
26552655 assert_end_location " foo.bar(x) do; end"
2656+ assert_end_location " foo(bar: 123)"
2657+ assert_end_location " foo bar: 123"
2658+ assert_end_location " f foo(bar: 123)"
2659+ assert_end_location " f(foo bar: 123)"
2660+ assert_end_location " f foo bar: 123"
2661+ assert_end_location " f foo(x: 123, &.bar)"
2662+ assert_end_location " f foo x: 123, &.bar"
26562663 assert_end_location " %w(one two)"
26572664 assert_end_location " {%\n if foo\n bar\n end\n %}" , line_number: 5 , column_number: 2
26582665 assert_end_location " foo bar, out baz"
Original file line number Diff line number Diff line change @@ -4851,7 +4851,12 @@ module Crystal
48514851 end
48524852
48534853 check :OP_RPAREN if allow_newline
4854- end_location = token_end_location
4854+
4855+ # Prefer the end location of the last named argument when available.
4856+ # Using `token_end_location` would produce an off-by-one column
4857+ # in some cases (see issue #16092).
4858+ end_location = named_args.last?.try(& .end_location) unless allow_newline
4859+ end_location ||= token_end_location
48554860
48564861 if allow_newline
48574862 next_token_skip_space
You can’t perform that action at this time.
0 commit comments