Skip to content

parser: reject an indexer without arguments - #83

Merged
rameel merged 1 commit into
mainfrom
parser/reject-empty-indexer
Nov 24, 2026
Merged

rameel merged 1 commit into
mainfrom
parser/reject-empty-indexer

Conversation

@rameel

@rameel rameel commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Fixes #82

As in C#, an indexer now takes at least one argument, so "abc"[] fails with (1:7) Expected expression at the position of ] instead of a binding error when the expression is built.

An indexer was parsed with the argument list of a call, which can be
empty, so "abc"[] was accepted and failed only when the expression was
built: with "Ambiguous match found" for a string, a list, or a
dictionary, and with "Incorrect number of indexes" for an array.

As in C#, an indexer now takes at least one argument, and "abc"[] fails
with "(1:7) Expected expression" at the position of ]. The argument
list is labeled "expression" so that the message does not list every
token that can start an expression.
@rameel
rameel merged commit bf2a238 into main Nov 24, 2026
1 check passed
@rameel
rameel deleted the parser/reject-empty-indexer branch November 24, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An empty indexer "abc"[] fails with "Ambiguous match found" instead of a syntax error

1 participant