Repository navigation
A rest parameter of a primitive type is an error at the parameter - #589
Merged
Merged
Conversation
`function f(...a: int) {}; f(1, 2);` reached the MLIR verifier:
"'ts.CreateArray' op result #0 must be ..." at the call, then "module
verification error" at 1:1. The arguments a rest parameter takes are
put in an array, so TypeScript requires an array type; tslang now
rejects a number, string, boolean, bigint or char one at the
parameter. Arrays, tuples, any and generic rest parameters are left
as they were.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
function f(...a: int) {}; f(1, 2);reached the MLIR verifier:'ts.CreateArray' op result #0 must be ..., but got 'si32'at the call, thenmodule verification errorat 1:1.Fix: a declared rest parameter of a number, string, boolean, bigint or char type is an error at the parameter:
A rest parameter must be of an array type, not 's32'. Arrays, tuples,anyand generic rest parameters (...args: TS) are left as they were. Function types ((...args: any) => any) go through another path and are not changed.Repro (
diagnostic-location/rest_parameter_type.ts):The test fails on any "verification" text or a 1:1 location.
ctest -C Release -j 8 --timeout 300: 100% passed, 0 failed (4092 tests on this branch).🤖 Generated with Claude Code