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

Add a test case for issue #290 #343

Closed
wants to merge 6 commits into from

Conversation

ratmice
Copy link
Collaborator

@ratmice ratmice commented Aug 17, 2022

Here is an attempt to add a test case for #290. I tried to do something so that CI wouldn't trip over it,
but still allowed you to run it via passing cargo test --features test_known_failures. This could be flipped around,
so that it runs locally but you need to pass a feature to ignore it for CI.

Or it may be we just want to work on a fix before we commit a test for it?

@ltratt
Copy link
Member

ltratt commented Aug 17, 2022

Ideally we'd have a fix :) As a second possibility, we can add an "ignore" test to remind us to fix it, but I don't think we really want a complex test setup thingy that we're bound to be confused by in the future (at least I'll be confused!).

@ratmice
Copy link
Collaborator Author

ratmice commented Aug 17, 2022

Yeah, I was figuring I would look into this more now, since I'm concerned fixing it the way yacc does might require a semver bump.
I wanted to add a test, so I could try and see if come up with another instance of it that uses mutual recursion.

If there is no mutual recursive one, I can think of another approach that would fix it without the semver bump which may be a lot less work.

So I'll go ahead and put draft on it, for now and look into that stuff.

@ratmice ratmice marked this pull request as draft August 17, 2022 08:18
@@ -551,6 +577,8 @@ fn resolve_shift_reduce<StorageT: 'static + Hash + PrimInt + Unsigned>(
// If the token and production don't both have precedences, we use Yacc's default
// resolution, which is in favour of the shift.
actions[off] = StateTable::encode(Action::Shift(stidx));
let ridx = grm.prod_to_rule(pidx);
*rule_usage.get_mut(usize::from(ridx)).unwrap() = (ridx, true);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe this marking things as used when there is a conflict resolved in their favor may not be right,
in cases when there is some subsequent conflict with the production that it was resolved in favor of

Copy link
Member

Choose a reason for hiding this comment

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

I must admit that I have no idea!

Copy link
Collaborator Author

@ratmice ratmice Aug 19, 2022

Choose a reason for hiding this comment

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

Well, I'm going to try and avoid relying on that, if we look at what is still reachable after conflicts have been removed.
and use the forward pass merely for rules which are plain unused. It seems like a less fragile than trying to rely the above.

The actual problem I was running into with the case above, is the wrong pidx, and it seems much more difficult (if actually possible) to go from stidx back to a pidx, which working based on what was discarded it appears doesn't need to happen.

Copy link
Member

Choose a reason for hiding this comment

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

From memory, a StIdx can represent multiple productions. I'm not sure if that helps you either way!

@ltratt
Copy link
Member

ltratt commented Sep 1, 2022

I'm not sure if this one needs action?

@ratmice
Copy link
Collaborator Author

ratmice commented Sep 1, 2022

Going to close for now, as it has stalled in being able to get anything useful which doesn't have false positives.

@ratmice ratmice closed this Sep 1, 2022
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.

None yet

2 participants