Skip to content

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

Merged
parrt merged 1 commit into
antlr:devfrom
kaby76:antlr-4386-fixed
Sep 4, 2023

Conversation

@kaby76

@kaby76 kaby76 commented Aug 29, 2023

Copy link
Copy Markdown
Contributor

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 <kenneth.domino@domemtech.com>
@ericvergnaud

Copy link
Copy Markdown
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
mergify Bot added a commit to ArcadeData/arcadedb that referenced this pull request Jan 18, 2026
Bumps `antlr4.version` from 4.9.1 to 4.13.2.
Updates `org.antlr:antlr4-runtime` from 4.9.1 to 4.13.2
Release notes

*Sourced from [org.antlr:antlr4-runtime's releases](https://github.com/antlr/antlr4/releases).*

> 4.13.2
> ------
>
> Minor updates release.
>
> Pull requests grouped by target
> -------------------------------
>
> ### cpp target
>
> * [[Cpp] Use target\_include\_dirs for cmake targets](https://redirect.github.com/antlr/antlr4/pull/4661) (target:cpp)
> * [Update C++ documentation to state that C++17 is required](https://redirect.github.com/antlr/antlr4/pull/4588) (comp:doc, target:cpp)
>
> ### go target
>
> * [fix go-target.md, remove duplicate 'get'](https://redirect.github.com/antlr/antlr4/pull/4292) (comp:doc, target:go)
>
> ### javascript target
>
> * [fix(javascript): fix types not being recognized for NodeNext module resolution](https://redirect.github.com/antlr/antlr4/pull/4540) (target:javascript)
> * [[Javascript] Fix broken package entrypoints](https://redirect.github.com/antlr/antlr4/pull/4411) (target:javascript, type:cleanup)
>
> ### python3 target
>
> * [name 'state' conflict with Python3 runtime.](https://redirect.github.com/antlr/antlr4/pull/4312) (target:python3)
>
> Contributors
> ------------
>
> * 1 items: [njnobles](https://github.com/njnobles)
> * 1 items: [Andreas Buhr](https://github.com/andreasbuhr) (andreasbuhr)
> * 1 items: [Eric Vergnaud](https://github.com/ericvergnaud) (ericvergnaud)
> * 1 items: [Gökhan Kurt](https://github.com/KurtGokhan) (KurtGokhan)
> * 1 items: [johannesheesterman](https://github.com/johannesheesterman)
> * 1 items: [Alex Miller](https://github.com/Codex-) (Codex-)
> * 1 items: [GP4cK](https://github.com/GP4cK)
> * 1 items: [Alessandro Gatti](https://github.com/agatti) (agatti)
> * 1 items: [cyqw](https://github.com/cyqw)
> * 1 items: [css521](https://github.com/css521) (css521)
>
> 4.13.1
> ------
>
> Pull requests grouped by target
> -------------------------------
>
> ### csharp target
>
> * [[CSharp] Fix for [#4386](https://redirect.github.com/antlr/antlr4/issues/4386) -- change signatures for ReportAttemptingFullContext() and ReportContextSensitivity() to be identical to all other targets]([antlr/antlr4#4399](https://redirect.github.com/antlr/antlr4/pull/4399)) (target:csharp, type:cleanup)
>
> ### go target
>
> * [Move GetText(), SetText(), and String() from CommonToken to BaseToken](https://redirect.github.com/antlr/antlr4/pull/4397) (target:go, type:cleanup)
> * [Restore "Obtained from string" source name.](https://redirect.github.com/antlr/antlr4/pull/4396) (target:go, type:cleanup)
> * [fix: Fix very minor code issues spotted by goreportcard.com](https://redirect.github.com/antlr/antlr4/pull/4276) (target:go, type:cleanup)
>
> ### java target
>
> * [Java: suppress `this-escape` warning introduced in JDK 21.](https://redirect.github.com/antlr/antlr4/pull/4394) (actions, target:java)
>
> ### javascript target
>
> * [Adds default targets for babel configuration](https://redirect.github.com/antlr/antlr4/pull/4323) (target:javascript)
> * [fix dependabot warnings](https://redirect.github.com/antlr/antlr4/pull/4272) (target:javascript, type:cleanup)
>
> ### swift target

... (truncated)


Commits

* [`cc82115`](antlr/antlr4@cc82115) [maven-release-plugin] prepare release 4.13.2
* [`b91cecf`](antlr/antlr4@b91cecf) Update 4.13.1 -> 4.13.2
* [`35ff30d`](antlr/antlr4@35ff30d) Update release docs to say 4.13.2; rebuild XPathLexers
* [`2559349`](antlr/antlr4@2559349) fix(javascript): fix types not being recognized for NodeNext module resolutio...
* [`e8bf978`](antlr/antlr4@e8bf978) rule name 'state' conflict with Python runtime.
* [`88a0c7a`](antlr/antlr4@88a0c7a) Support TypeScript bundler module resolution
* [`caf46b9`](antlr/antlr4@caf46b9) [Python3] Replace deprecated `assertEquals()` to fix py3.12 compat
* [`17f3f5e`](antlr/antlr4@17f3f5e) Add include dirs direclty to cpp targets
* [`b3bb743`](antlr/antlr4@b3bb743) chore: fix error link
* [`7d4cea9`](antlr/antlr4@7d4cea9) Fix singleton memory leaks
* Additional commits viewable in [compare view](antlr/antlr4@4.9.1...4.13.2)
  
Updates `org.antlr:antlr4-maven-plugin` from 4.9.1 to 4.13.2
Release notes

*Sourced from [org.antlr:antlr4-maven-plugin's releases](https://github.com/antlr/antlr4/releases).*

> 4.13.2
> ------
>
> Minor updates release.
>
> Pull requests grouped by target
> -------------------------------
>
> ### cpp target
>
> * [[Cpp] Use target\_include\_dirs for cmake targets](https://redirect.github.com/antlr/antlr4/pull/4661) (target:cpp)
> * [Update C++ documentation to state that C++17 is required](https://redirect.github.com/antlr/antlr4/pull/4588) (comp:doc, target:cpp)
>
> ### go target
>
> * [fix go-target.md, remove duplicate 'get'](https://redirect.github.com/antlr/antlr4/pull/4292) (comp:doc, target:go)
>
> ### javascript target
>
> * [fix(javascript): fix types not being recognized for NodeNext module resolution](https://redirect.github.com/antlr/antlr4/pull/4540) (target:javascript)
> * [[Javascript] Fix broken package entrypoints](https://redirect.github.com/antlr/antlr4/pull/4411) (target:javascript, type:cleanup)
>
> ### python3 target
>
> * [name 'state' conflict with Python3 runtime.](https://redirect.github.com/antlr/antlr4/pull/4312) (target:python3)
>
> Contributors
> ------------
>
> * 1 items: [njnobles](https://github.com/njnobles)
> * 1 items: [Andreas Buhr](https://github.com/andreasbuhr) (andreasbuhr)
> * 1 items: [Eric Vergnaud](https://github.com/ericvergnaud) (ericvergnaud)
> * 1 items: [Gökhan Kurt](https://github.com/KurtGokhan) (KurtGokhan)
> * 1 items: [johannesheesterman](https://github.com/johannesheesterman)
> * 1 items: [Alex Miller](https://github.com/Codex-) (Codex-)
> * 1 items: [GP4cK](https://github.com/GP4cK)
> * 1 items: [Alessandro Gatti](https://github.com/agatti) (agatti)
> * 1 items: [cyqw](https://github.com/cyqw)
> * 1 items: [css521](https://github.com/css521) (css521)
>
> 4.13.1
> ------
>
> Pull requests grouped by target
> -------------------------------
>
> ### csharp target
>
> * [[CSharp] Fix for [#4386](https://redirect.github.com/antlr/antlr4/issues/4386) -- change signatures for ReportAttemptingFullContext() and ReportContextSensitivity() to be identical to all other targets]([antlr/antlr4#4399](https://redirect.github.com/antlr/antlr4/pull/4399)) (target:csharp, type:cleanup)
>
> ### go target
>
> * [Move GetText(), SetText(), and String() from CommonToken to BaseToken](https://redirect.github.com/antlr/antlr4/pull/4397) (target:go, type:cleanup)
> * [Restore "Obtained from string" source name.](https://redirect.github.com/antlr/antlr4/pull/4396) (target:go, type:cleanup)
> * [fix: Fix very minor code issues spotted by goreportcard.com](https://redirect.github.com/antlr/antlr4/pull/4276) (target:go, type:cleanup)
>
> ### java target
>
> * [Java: suppress `this-escape` warning introduced in JDK 21.](https://redirect.github.com/antlr/antlr4/pull/4394) (actions, target:java)
>
> ### javascript target
>
> * [Adds default targets for babel configuration](https://redirect.github.com/antlr/antlr4/pull/4323) (target:javascript)
> * [fix dependabot warnings](https://redirect.github.com/antlr/antlr4/pull/4272) (target:javascript, type:cleanup)
>
> ### swift target

... (truncated)


Commits

* [`cc82115`](antlr/antlr4@cc82115) [maven-release-plugin] prepare release 4.13.2
* [`b91cecf`](antlr/antlr4@b91cecf) Update 4.13.1 -> 4.13.2
* [`35ff30d`](antlr/antlr4@35ff30d) Update release docs to say 4.13.2; rebuild XPathLexers
* [`2559349`](antlr/antlr4@2559349) fix(javascript): fix types not being recognized for NodeNext module resolutio...
* [`e8bf978`](antlr/antlr4@e8bf978) rule name 'state' conflict with Python runtime.
* [`88a0c7a`](antlr/antlr4@88a0c7a) Support TypeScript bundler module resolution
* [`caf46b9`](antlr/antlr4@caf46b9) [Python3] Replace deprecated `assertEquals()` to fix py3.12 compat
* [`17f3f5e`](antlr/antlr4@17f3f5e) Add include dirs direclty to cpp targets
* [`b3bb743`](antlr/antlr4@b3bb743) chore: fix error link
* [`7d4cea9`](antlr/antlr4@7d4cea9) Fix singleton memory leaks
* Additional commits viewable in [compare view](antlr/antlr4@4.9.1...4.13.2)
  
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
tae898 pushed a commit to humemai/arcadedb-embedded-python that referenced this pull request Jun 28, 2026
Bumps `antlr4.version` from 4.9.1 to 4.13.2.
Updates `org.antlr:antlr4-runtime` from 4.9.1 to 4.13.2
Release notes

*Sourced from [org.antlr:antlr4-runtime's releases](https://github.com/antlr/antlr4/releases).*

> 4.13.2
> ------
>
> Minor updates release.
>
> Pull requests grouped by target
> -------------------------------
>
> ### cpp target
>
> * [[Cpp] Use target\_include\_dirs for cmake targets](https://redirect.github.com/antlr/antlr4/pull/4661) (target:cpp)
> * [Update C++ documentation to state that C++17 is required](https://redirect.github.com/antlr/antlr4/pull/4588) (comp:doc, target:cpp)
>
> ### go target
>
> * [fix go-target.md, remove duplicate 'get'](https://redirect.github.com/antlr/antlr4/pull/4292) (comp:doc, target:go)
>
> ### javascript target
>
> * [fix(javascript): fix types not being recognized for NodeNext module resolution](https://redirect.github.com/antlr/antlr4/pull/4540) (target:javascript)
> * [[Javascript] Fix broken package entrypoints](https://redirect.github.com/antlr/antlr4/pull/4411) (target:javascript, type:cleanup)
>
> ### python3 target
>
> * [name 'state' conflict with Python3 runtime.](https://redirect.github.com/antlr/antlr4/pull/4312) (target:python3)
>
> Contributors
> ------------
>
> * 1 items: [njnobles](https://github.com/njnobles)
> * 1 items: [Andreas Buhr](https://github.com/andreasbuhr) (andreasbuhr)
> * 1 items: [Eric Vergnaud](https://github.com/ericvergnaud) (ericvergnaud)
> * 1 items: [Gökhan Kurt](https://github.com/KurtGokhan) (KurtGokhan)
> * 1 items: [johannesheesterman](https://github.com/johannesheesterman)
> * 1 items: [Alex Miller](https://github.com/Codex-) (Codex-)
> * 1 items: [GP4cK](https://github.com/GP4cK)
> * 1 items: [Alessandro Gatti](https://github.com/agatti) (agatti)
> * 1 items: [cyqw](https://github.com/cyqw)
> * 1 items: [css521](https://github.com/css521) (css521)
>
> 4.13.1
> ------
>
> Pull requests grouped by target
> -------------------------------
>
> ### csharp target
>
> * [[CSharp] Fix for [ArcadeData#4386](https://redirect.github.com/antlr/antlr4/issues/4386) -- change signatures for ReportAttemptingFullContext() and ReportContextSensitivity() to be identical to all other targets]([antlr/antlr4#4399](https://redirect.github.com/antlr/antlr4/pull/4399)) (target:csharp, type:cleanup)
>
> ### go target
>
> * [Move GetText(), SetText(), and String() from CommonToken to BaseToken](https://redirect.github.com/antlr/antlr4/pull/4397) (target:go, type:cleanup)
> * [Restore "Obtained from string" source name.](https://redirect.github.com/antlr/antlr4/pull/4396) (target:go, type:cleanup)
> * [fix: Fix very minor code issues spotted by goreportcard.com](https://redirect.github.com/antlr/antlr4/pull/4276) (target:go, type:cleanup)
>
> ### java target
>
> * [Java: suppress `this-escape` warning introduced in JDK 21.](https://redirect.github.com/antlr/antlr4/pull/4394) (actions, target:java)
>
> ### javascript target
>
> * [Adds default targets for babel configuration](https://redirect.github.com/antlr/antlr4/pull/4323) (target:javascript)
> * [fix dependabot warnings](https://redirect.github.com/antlr/antlr4/pull/4272) (target:javascript, type:cleanup)
>
> ### swift target

... (truncated)


Commits

* [`cc82115`](antlr/antlr4@cc82115) [maven-release-plugin] prepare release 4.13.2
* [`b91cecf`](antlr/antlr4@b91cecf) Update 4.13.1 -> 4.13.2
* [`35ff30d`](antlr/antlr4@35ff30d) Update release docs to say 4.13.2; rebuild XPathLexers
* [`2559349`](antlr/antlr4@2559349) fix(javascript): fix types not being recognized for NodeNext module resolutio...
* [`e8bf978`](antlr/antlr4@e8bf978) rule name 'state' conflict with Python runtime.
* [`88a0c7a`](antlr/antlr4@88a0c7a) Support TypeScript bundler module resolution
* [`caf46b9`](antlr/antlr4@caf46b9) [Python3] Replace deprecated `assertEquals()` to fix py3.12 compat
* [`17f3f5e`](antlr/antlr4@17f3f5e) Add include dirs direclty to cpp targets
* [`b3bb743`](antlr/antlr4@b3bb743) chore: fix error link
* [`7d4cea9`](antlr/antlr4@7d4cea9) Fix singleton memory leaks
* Additional commits viewable in [compare view](antlr/antlr4@4.9.1...4.13.2)
  
Updates `org.antlr:antlr4-maven-plugin` from 4.9.1 to 4.13.2
Release notes

*Sourced from [org.antlr:antlr4-maven-plugin's releases](https://github.com/antlr/antlr4/releases).*

> 4.13.2
> ------
>
> Minor updates release.
>
> Pull requests grouped by target
> -------------------------------
>
> ### cpp target
>
> * [[Cpp] Use target\_include\_dirs for cmake targets](https://redirect.github.com/antlr/antlr4/pull/4661) (target:cpp)
> * [Update C++ documentation to state that C++17 is required](https://redirect.github.com/antlr/antlr4/pull/4588) (comp:doc, target:cpp)
>
> ### go target
>
> * [fix go-target.md, remove duplicate 'get'](https://redirect.github.com/antlr/antlr4/pull/4292) (comp:doc, target:go)
>
> ### javascript target
>
> * [fix(javascript): fix types not being recognized for NodeNext module resolution](https://redirect.github.com/antlr/antlr4/pull/4540) (target:javascript)
> * [[Javascript] Fix broken package entrypoints](https://redirect.github.com/antlr/antlr4/pull/4411) (target:javascript, type:cleanup)
>
> ### python3 target
>
> * [name 'state' conflict with Python3 runtime.](https://redirect.github.com/antlr/antlr4/pull/4312) (target:python3)
>
> Contributors
> ------------
>
> * 1 items: [njnobles](https://github.com/njnobles)
> * 1 items: [Andreas Buhr](https://github.com/andreasbuhr) (andreasbuhr)
> * 1 items: [Eric Vergnaud](https://github.com/ericvergnaud) (ericvergnaud)
> * 1 items: [Gökhan Kurt](https://github.com/KurtGokhan) (KurtGokhan)
> * 1 items: [johannesheesterman](https://github.com/johannesheesterman)
> * 1 items: [Alex Miller](https://github.com/Codex-) (Codex-)
> * 1 items: [GP4cK](https://github.com/GP4cK)
> * 1 items: [Alessandro Gatti](https://github.com/agatti) (agatti)
> * 1 items: [cyqw](https://github.com/cyqw)
> * 1 items: [css521](https://github.com/css521) (css521)
>
> 4.13.1
> ------
>
> Pull requests grouped by target
> -------------------------------
>
> ### csharp target
>
> * [[CSharp] Fix for [ArcadeData#4386](https://redirect.github.com/antlr/antlr4/issues/4386) -- change signatures for ReportAttemptingFullContext() and ReportContextSensitivity() to be identical to all other targets]([antlr/antlr4#4399](https://redirect.github.com/antlr/antlr4/pull/4399)) (target:csharp, type:cleanup)
>
> ### go target
>
> * [Move GetText(), SetText(), and String() from CommonToken to BaseToken](https://redirect.github.com/antlr/antlr4/pull/4397) (target:go, type:cleanup)
> * [Restore "Obtained from string" source name.](https://redirect.github.com/antlr/antlr4/pull/4396) (target:go, type:cleanup)
> * [fix: Fix very minor code issues spotted by goreportcard.com](https://redirect.github.com/antlr/antlr4/pull/4276) (target:go, type:cleanup)
>
> ### java target
>
> * [Java: suppress `this-escape` warning introduced in JDK 21.](https://redirect.github.com/antlr/antlr4/pull/4394) (actions, target:java)
>
> ### javascript target
>
> * [Adds default targets for babel configuration](https://redirect.github.com/antlr/antlr4/pull/4323) (target:javascript)
> * [fix dependabot warnings](https://redirect.github.com/antlr/antlr4/pull/4272) (target:javascript, type:cleanup)
>
> ### swift target

... (truncated)


Commits

* [`cc82115`](antlr/antlr4@cc82115) [maven-release-plugin] prepare release 4.13.2
* [`b91cecf`](antlr/antlr4@b91cecf) Update 4.13.1 -> 4.13.2
* [`35ff30d`](antlr/antlr4@35ff30d) Update release docs to say 4.13.2; rebuild XPathLexers
* [`2559349`](antlr/antlr4@2559349) fix(javascript): fix types not being recognized for NodeNext module resolutio...
* [`e8bf978`](antlr/antlr4@e8bf978) rule name 'state' conflict with Python runtime.
* [`88a0c7a`](antlr/antlr4@88a0c7a) Support TypeScript bundler module resolution
* [`caf46b9`](antlr/antlr4@caf46b9) [Python3] Replace deprecated `assertEquals()` to fix py3.12 compat
* [`17f3f5e`](antlr/antlr4@17f3f5e) Add include dirs direclty to cpp targets
* [`b3bb743`](antlr/antlr4@b3bb743) chore: fix error link
* [`7d4cea9`](antlr/antlr4@7d4cea9) Fix singleton memory leaks
* Additional commits viewable in [compare view](antlr/antlr4@4.9.1...4.13.2)
  
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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