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 precedence of safe-accessor tail #525

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

marcelocantos
Copy link
Contributor

@marcelocantos marcelocantos commented Jul 28, 2020

Fixes #552

Change safe-accessor tail to expect an expr instead of the next rule on the precedence stack.

The expression a.b?:c.d used to parse as (a.b?:c).d. This is confusing because it means that .d, which looks like it belongs to c, actually applies to a.b if a has a b attribute. This PR changes it to parse as a.b?:(c.d).

This is actually a bit of a hack. My preference would be to loop back to the current rule. However, wbnf doesn't have a way to refer to the current rule, only the next rule (@) or back to the top (expr). It might be better to add this capability to wbnf. Comments welcome.

Checklist:

  • Added related tests
  • Made corresponding changes to the documentation

@coveralls
Copy link

coveralls commented Jul 28, 2020

Pull Request Test Coverage Report for Build 8d2f7b7b1dc05aee43438caf9f604d54f9184dc3-PR-525

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage remained the same at 47.706%

Files with Coverage Reduction New Missed Lines %
rel/value_set_generic.go 2 74.47%
Totals Coverage Status
Change from base Build cea02743513c00478f8b88caad0546ce96ae2133: 0.0%
Covered Lines: 4533
Relevant Lines: 9502

💛 - Coveralls

@orlade-anz
Copy link
Contributor

orlade-anz commented Aug 2, 2020

Can you add a description of what this is actually doing for posterity?

It looks vaguely related to #532 but doesn't fix it.

@orlade-anz orlade-anz self-requested a review August 4, 2020 23:56
Copy link
Contributor

@orlade-anz orlade-anz left a comment

Choose a reason for hiding this comment

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

The description is good but hard to grok; can you also add a test case that would have failed before but should pass now and vice versa?

@marcelocantos
Copy link
Contributor Author

We really should fix the stack operator in wbnf so that this rule can be self-referential. arr-ai/wbnf#85

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

Successfully merging this pull request may close these issues.

Fix precedence of safe-accessor tail
4 participants