Skip to content

✨ feat: support variadic function arguments and enhance error handling#1214

Merged
harehare merged 1 commit intomainfrom
feat/support-variadic-function-arguments
Feb 3, 2026
Merged

✨ feat: support variadic function arguments and enhance error handling#1214
harehare merged 1 commit intomainfrom
feat/support-variadic-function-arguments

Conversation

@harehare
Copy link
Copy Markdown
Owner

@harehare harehare commented Feb 3, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 3, 2026 13:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces support for variadic function arguments (e.g., *args) to the mq language, allowing functions to accept a variable number of arguments. The implementation includes comprehensive validation to prevent invalid variadic parameter usage, such as ensuring variadic parameters are always last and prohibiting their use in macros.

Changes:

  • Added variadic parameter support to the AST, parser, evaluator, and HIR
  • Implemented validation rules: variadic parameters must be last, only one allowed per function, and macros cannot have variadic parameters
  • Updated LSP, formatter, and HIR to properly display and handle variadic parameters

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/mq-lsp/src/hover.rs Updated hover display to use to_string() for parameters to include variadic notation
crates/mq-lsp/src/completions.rs Updated completion snippet generation to support variadic parameter display
crates/mq-lang/tests/integration_tests.rs Added comprehensive test cases for variadic parameter functionality and error conditions
crates/mq-lang/src/eval.rs Implemented variadic argument collection and modified argument count validation logic
crates/mq-lang/src/error/syntax.rs Added new error types for variadic parameter validation
crates/mq-lang/src/error.rs Added diagnostic messages for variadic parameter errors
crates/mq-lang/src/cst/parser.rs Extended CST parser to recognize and parse variadic parameter syntax
crates/mq-lang/src/ast/parser.rs Implemented AST-level variadic parameter parsing and validation
crates/mq-lang/src/ast/node.rs Added is_variadic field to Param struct and updated display formatting
crates/mq-hir/src/symbol.rs Added is_variadic field to ParamInfo and updated symbol display
crates/mq-hir/src/hir.rs Updated HIR to detect and track variadic parameters from CST
crates/mq-formatter/src/formatter.rs Enhanced formatter to correctly output variadic parameter syntax

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 3, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing feat/support-variadic-function-arguments (bf46d1f) with main (ea2306c)1

Summary

✅ 29 untouched benchmarks

Footnotes

  1. No successful run was found on main (c600e19) during the generation of this report, so ea2306c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@harehare harehare requested a review from Copilot February 3, 2026 13:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

@harehare harehare merged commit 36d9517 into main Feb 3, 2026
7 checks passed
@harehare harehare deleted the feat/support-variadic-function-arguments branch February 3, 2026 14:11
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.

2 participants