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

Parser: fix wrong/missing locations of various AST nodes #11798

Merged
merged 55 commits into from
Dec 20, 2022

Conversation

FnControlOption
Copy link
Contributor

I've included examples in tests and commit description, but if you want I can split this PR into multiple PRs.

`else_location` should be `nil` if `else` block is not present.
For example:
  foo.[0] = 1
For example:
  {%
  if foo
    bar
  end
  %}
For example:
  foo bar, out baz
For example:
  foo : Foo.class
  foo : Foo?
  foo : Foo*
  foo : Foo**
  foo : Foo[42]
For example:
  foo ->bar(Baz)
For example:
  x : Foo -> Bar
@oprypin oprypin self-requested a review February 4, 2022 09:13
end_loc = node.end_location.not_nil!
end_loc.line_number.should eq(line_number)
end_loc.column_number.should eq(column_number)
source_between(string, loc, end_loc).should eq(source)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this expectation? I don't see how the source string comparison adds any relevant information to just the end location.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s useful for checking if the start location is set correctly (so maybe I should move this to a separate test). However, I think the string comparison is easier to understand at a glance than line/column numbers (when the test fails), so perhaps we can delete the number comparisons altogether?

@HertzDevil
Copy link
Contributor

Where does the internal compiler error come from?

@Sija
Copy link
Contributor

Sija commented Dec 9, 2022

Could this make it into 1.7.0, pretty please? :)

@Sija
Copy link
Contributor

Sija commented Dec 18, 2022

CI is 💚 , 2nd review anyone?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants