Skip to content

Parser ignores &( ), &[ ], &{ } patterns in assignment #16713

@amistozy

Description

@amistozy

Summary

The parser appears to silently ignore &( ), &[ ], and &{ } when they appear in assignments.

Reproduction

x &(a) = 1
y &[b] = 2
z &{c} = 3
p! x, y, z

Expected behavior

The compiler should raise a syntax error, because &(a), &[b], and &{c} are not valid syntax in this context.

Actual behavior

The code compiles and runs, producing:

x # => 1
y # => 2
z # => 3

It seems that &(a), &[b], and &{c} are simply ignored by the parser.

Crystal version

> crystal --version

Crystal 1.19.1 [a3178c3] (2026-01-20)

LLVM: 20.1.7
Default target: x86_64-pc-windows-msvc

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugA bug in the code. Does not apply to documentation, specs, etc.topic:compiler:parser

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions