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

Versioning problems: TypeError: Cannot read private member #intervals #157

Open
trygvea opened this issue Oct 16, 2024 · 6 comments
Open

Comments

@trygvea
Copy link

trygvea commented Oct 16, 2024

I get
TypeError: Cannot read private member #intervals from an object whose class did not declare it
at _IntervalSet.addSet (/Users/trygve/prj/antlr/aql-parser/node_modules/antlr4-c3/node_modules/antlr4ng/dist/index.cjs:605:11)
at _CodeCompletionCore.determineFollowSets (/Users/trygve/prj/antlr/aql-parser/node_modules/antlr4-c3/lib/index.cjs:1208:16)
at _CodeCompletionCore.processRule (/Users/trygve/prj/antlr/aql-parser/node_modules/antlr4-c3/lib/index.cjs:1338:25)
at _CodeCompletionCore.collectCandidates (/Users/trygve/prj/antlr/aql-parser/node_modules/antlr4-c3/lib/index.cjs:1063:10)

It seems to be caused by the following version problems:

When using [email protected] together with [email protected] , everything works fine.
When using [email protected] together with [email protected] (or > 3.0.4), the above error occurs.

(antlr4-c3 depends on antlr4ng using "^3.0.1", ie a minor/patch wildcard, so this is a real problem 😄 )

So, the cause is probably either a semver violation in antlr4ng 3.0.5, i.e. a patch version having breaking changes, or that antlr4-c3 uses some internal stuff in antlr4ng, and should use an exact dependency.

Thanks for a great library!

@mike-lischke
Copy link
Owner

I cannot reproduce this problem. The unit tests just run fine. Can you make a small test project showing the wrong behavior?

@trygvea
Copy link
Author

trygvea commented Oct 16, 2024

Hmm. I get it everywhere I call core.collectCandidates, but only when yarn resolves to using [email protected] (or > 3.0.4).
This is an internal project so I have to extract the essence. I'll see what I can do.

@trygvea
Copy link
Author

trygvea commented Oct 17, 2024

A minimal test project reproducing the error: https://github.com/trygvea/antlr4-c3-issue157

@trygvea
Copy link
Author

trygvea commented Oct 17, 2024

I found a simple fix for me: I now use the latest [email protected], AND force antlr4-c3 to use the same version by regenerating the lockfile (or manually editing it).

@mike-lischke
Copy link
Owner

Many thanks for that test project! For the lock file: could be another case where using the "^" specifier in package.json causing trouble. I almost entirely banned that from all my projects. And upgrading packages always involves removing the package-lock.json file.

@trygvea
Copy link
Author

trygvea commented Oct 17, 2024

I agree, except you probably should use the ^ in antlr4-c3 (using antlr4ng@^3.0.1), because you want the user to specify the version, and want antlr4-c3 to use the same. But as far as I see yarn (and possibly npm?) messes this up and uses different versions.
But still, at the core, this should really be no problem if the minor versions of antlr4ng was compatible 😄

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

No branches or pull requests

2 participants