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

[CSharp] Fix for #4386 -- change signatures for ReportAttemptingFullContext() and ReportContextSensitivity() to be identical to all other targets #4399

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Aug 29, 2023

This is a fix for #4386: fix signatures of ReportAttemptingFullContext() and ReportContextSensitivity() for the CSharp.

In this PR, I changed the signatures for ReportAttemptingFullContext() and ReportContextSensitivity() for the CSharp runtime to be identical to that for all the other runtimes. The code before this change appears to be written with the idea of exposing the prediction context in some other way. But, it seems the idea never was thought completely out, and what was implemented was basically useless null pointers being passed around for no reason. This change exposes the ATN config sets so I can then actually create meaningful error messages and perform a better analysis of why a grammar is performing poorly. Without the change, we are left with code that doesn't work the same way as all the other targets, and doesn't really help us to figure out why a grammar is bad.

Incidentally, you may be wondering why ReportAmbiguity() does not have the same problem with the signature as the others. It appears that came from initial check-in of the runtime for CSharp. e8c4bc4#diff-46a0f5d3e67ea8c3d1c4fe92bd6fbbe9bcdfcf01fd05b6cb8bcc4286ac532488R99

There are no tests for this API change. In fact, there were no tests for any of the API to display diagnostic errors for CSharp. And, it's unfair to require I write all these tests from scratch at this point. It should have been done years ago, with this a commit with just one word for the description.

…Sensitivity() to be identical to all other targets

Signed-off-by: Ken Domino <[email protected]>
@ericvergnaud
Copy link
Contributor

lgtm

@kaby76 kaby76 marked this pull request as ready for review August 30, 2023 09:43
@parrt parrt added this to the 4.13.1 milestone Sep 4, 2023
@parrt parrt merged commit ff4cfae into antlr:dev Sep 4, 2023
42 checks passed
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.

3 participants