{"record":{"id":"1f5bec4b157e3ff3","repo":"antlr/antlr4","slug":"index","errorCode":null,"errorMessage":"index","messagePattern":"index","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"runtime/CSharp/src/Sharpen/BitSet.cs","lineNumber":121,"sourceCode":"        {\n            if (value == 0)\n                return -1;\n\n            const ulong debruijn64 = 0x03f79d71b4cb0a89;\n            return index64[((value ^ (value - 1)) * debruijn64) >> 58];\n        }\n\n        public BitSet Clone()\n        {\n            BitSet result = new BitSet();\n            result._data = (ulong[])_data.Clone();\n            return result;\n        }\n\n        public void Clear(int index)\n        {\n            if (index < 0)\n                throw new ArgumentOutOfRangeException(\"index\");\n\n            int element = index / BitsPerElement;\n            if (element >= _data.Length)\n                return;\n\n            _data[element] &= ~(1UL << (index % BitsPerElement));\n        }\n\n\t\tpublic bool this[int index]\n\t\t{\n\t\t\tget\n\t\t\t{\n\t\t\t\treturn Get(index);\n\t\t\t}\n\t\t\tset\n\t\t\t{\n\t\t\t\tSet(index);\n\t\t\t}","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/antlr/antlr4/blob/7d5770395bb7b02eb56e7c62662cb1d7c08f42a3/runtime/CSharp/src/Sharpen/BitSet.cs#L103-L139","documentation":"Error \"index\" thrown in antlr/antlr4.","triggerScenarios":"BitSet.Get/Set/Clear called with a negative index.","commonSituations":"Validate bit index >= 0 before BitSet operations.","solutions":["Pass a non-negative index to the BitSet operation; clamp or validate the index at the call site.","Check index >= 0 && index < Capacity before Get/Set."],"exampleFix":"if (index >= 0) bits.Set(index, true);","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d5770395bb7b02eb56e7c62662cb1d7c08f42a3","analyzedAt":"2026-08-14T14:47:56.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}