Skip to content

Dimensionality check misses captures inside enum branches #495

Description

@zharinov

A quantifier with captures inside it needs a struct/row capture. check enforces this for sequences but not for enum (labeled alternation) branches.

Repro

# enum branch with an internal capture, no row capture — accepted (wrong):
cargo run -p plotnik -- check -l javascript -q 'Q = [A: (identifier) @id]*'
# []   (no error)

# same shape written as a sequence — correctly rejected:
cargo run -p plotnik -- check -l javascript -q 'Q = {(identifier) @id}*'
# error: quantifier `*` contains captures (`@id`) but has no struct capture

Expected

[A: (identifier) @id]* should raise the same strict_dimensionality_violation error, since @id is a capture inside the quantified body.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions