mike-lischke / antlr4-c3

A grammar agnostic code completion engine for ANTLR4 based parsers
MIT License
407 stars 62 forks source link

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

Open trygvea opened 4 hours ago

trygvea commented 4 hours ago

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 antlr4-c3@3.4.1 together with antlr4ng@3.0.4 , everything works fine. When using antlr4-c3@3.4.1 together with antlr4ng@3.0.7 (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 commented 3 hours ago

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

trygvea commented 3 hours ago

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