Port "Error on too many parameters for iterator method"#1059
Port "Error on too many parameters for iterator method"#1059jakebailey merged 2 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR ports the error reporting for too many parameters in iterator methods to a new error code, updating error messages in both synchronous and asynchronous iterator tests while enhancing the iteration type resolution in checker.go.
- Update error messages in iterator and async iterator error baselines
- Introduce new checked iterable type resolvers and adjust signature filtering in the checker
- Update baseline files to reflect the new error codes and messages
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/baselines/reference/submodule/compiler/iteratorExtraParameters.errors.txt.diff | Updated error messages from TS2488 to TS2322 for iterator extra parameters |
| testdata/baselines/reference/submodule/compiler/iteratorExtraParameters.errors.txt | Updated baseline error messages for iterator methods |
| testdata/baselines/reference/submodule/compiler/asyncIteratorExtraParameters.errors.txt.diff | Updated error messages from TS2504 to TS2322 for async iterator extra parameters |
| testdata/baselines/reference/submodule/compiler/asyncIteratorExtraParameters.errors.txt | Updated baseline error messages for async iterator methods |
| internal/checker/checker.go | Added new checked iterable type resolvers and refined signature filtering logic |
Comments suppressed due to low confidence (1)
internal/checker/checker.go:6055
- [nitpick] Consider adding a comment to explain why signatures with a minimum argument count of 0 are filtered as valid. This can help maintain the clarity of the iteration type resolution logic for future maintainers.
allSignatures := c.getSignaturesOfType(methodType, SignatureKindCall)
There was a problem hiding this comment.
this is still different for 2 reasons:
- diagnostics/error output containers don't support
skipLogging(yet?) - there is no logic to ignore cached values for
IterationTypes{}(akanoIterationTypes) and thus repeated errors are not reported. I'll fix this in a followup PR
There was a problem hiding this comment.
For the first thing, I'm pretty sure this is a place where we're differing because the code wasn't ported but redone from scratch. So I don't think that's a simple fix.
| validSignatures := core.Filter(allSignatures, func(sig *Signature) bool { | ||
| return c.getMinArgumentCount(sig) == 0 | ||
| }) | ||
| if len(validSignatures) != 0 { |
There was a problem hiding this comment.
It feels suspicious that this condition is flipped from the original code...
There was a problem hiding this comment.
It's just because the actual branches here are flipped, this allowed me to nearly fall through to the IterationTypes{} case in the case when valid signatures are missing
jakebailey
left a comment
There was a problem hiding this comment.
Seems correct modulo the larger errors.
ports microsoft/TypeScript#60321