Skip to content

✨ feat(mq-lang): add spread operator for array and dict literals#1960

Open
harehare wants to merge 4 commits into
mainfrom
feat/spread-operator
Open

✨ feat(mq-lang): add spread operator for array and dict literals#1960
harehare wants to merge 4 commits into
mainfrom
feat/spread-operator

Conversation

@harehare

@harehare harehare commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Close #1945

@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing feat/spread-operator (ee8744e) with main (9367593)

Open in CodSpeed

@harehare harehare force-pushed the feat/spread-operator branch 2 times, most recently from c9a345b to 90be3e2 Compare July 4, 2026 14:41
harehare added 4 commits July 5, 2026 09:40
Support `...expr` inside `[...]` and `{...}` literals, splicing an
array's elements or a dict's entries into the enclosing literal at
eval time. Adds lexer/parser/CST support, HIR lowering, type
inference in mq-check, formatter support, and LSP semantic tokens.
- Skip the spread-marker check for non-array/dict builtin calls, since
  `...expr` can only ever be parsed inside an array/dict literal.
- Merge expand_spread's array/dict match arms to drop duplicated
  None/error handling.
- Extract parse_dict's repeated comma/closing-brace tail logic (spread
  vs. key:value entries) into a shared parse_dict_separator helper.
…rray typing

`[...]`/`{...}` now always expand via the real array/dict builtin even
when array/dict is shadowed by a user-defined function, instead of
leaking the internal spread marker as an unresolved-identifier error.

An array containing a spread element is no longer misclassified as a
fixed-arity Tuple in mq-check; it now stays Array<T>, with genuinely
heterogeneous elements still reported as a type error via unification.

Adds regression tests across mq-lang, mq-check, mq-hir, mq-formatter,
and mq-lsp, plus a shared is_spread_symbol helper to remove duplicated
SymbolKind::Spread checks.
… operator

Condense multi-line explanatory comments to single lines and remove
comments that only restated the code.
@harehare harehare force-pushed the feat/spread-operator branch from 90be3e2 to ee8744e Compare July 5, 2026 00:46
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.

Spread operator (...) for arrays and dicts

1 participant