Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix end locations of Alias nodes #14271

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions spec/compiler/parser/parser_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2252,6 +2252,7 @@ module Crystal
assert_end_location "class Foo; end"
assert_end_location "struct Foo; end"
assert_end_location "module Foo; end"
assert_end_location "alias Foo = Bar"
assert_end_location "->{ }"
assert_end_location "macro foo;end"
assert_end_location "macro foo; 123; end"
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/crystal/syntax/parser.cr
Original file line number Diff line number Diff line change
Expand Up @@ -5852,9 +5852,10 @@ module Crystal
next_token_skip_space_or_newline

value = parse_bare_proc_type
end_location = value.end_location
skip_space

alias_node = Alias.new(name, value)
alias_node = Alias.new(name, value).at_end(end_location)
alias_node.doc = doc
alias_node
end
Expand Down
Loading