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 c293e8ca5c743b40acee1500092d00da4d6541df-PR-525

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.04%) to 48.034%

Files with Coverage Reduction New Missed Lines %
syntax/import_cache.go 1 77.27%
rel/value_tuple.go 2 75.2%
Totals Coverage Status
Change from base Build 6ca2c118006fa40a4732f1387f9a84906ef94f73: 0.04%
Covered Lines: 4423
Relevant Lines: 9208

💛 - 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