✨ feat(mq-lang): add spread operator for array and dict literals#1960
Open
harehare wants to merge 4 commits into
Open
✨ feat(mq-lang): add spread operator for array and dict literals#1960harehare wants to merge 4 commits into
harehare wants to merge 4 commits into
Conversation
c9a345b to
90be3e2
Compare
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.
90be3e2 to
ee8744e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #1945