-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some more active pattern error message improvements + tests #17186
Merged
Conversation
This file contains 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
* Don't imply that a pattern argument is needed when it may (and should) be omitted. * A typar with (most kinds of) constraints cannot be unit. * Add more comprehensive tests for active pattern arg count error messages.
❗ Release notes required
|
T-Gro
approved these changes
May 21, 2024
edgarfgp
approved these changes
May 21, 2024
psfinaki
approved these changes
May 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work and great tests, thanks!
This was referenced May 27, 2024
2 tasks
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.
Description
Followup to #16846 (thanks for that, @Tangent-90!).
Don't imply that a pattern argument is needed when it may (and should) be omitted.
E.g., for
the error was originally
and after Add error tcActivePatternArgumentCountNotMatch #16846 became
which was technically correct but encouraged adding an explicit pattern for
unit
, which is normally omitted.The error is now instead
A typar with (most kinds of) constraints cannot be unit. Knowing this lets us use the improved error messages in more scenarios.
Add more comprehensive tests for active pattern arg count error messages. They're not truly comprehensive — there are more fun combinations to try, like
val (|P|) : int -> bool
(as opposed toval (|P|_|) : int -> bool
),val (|P|_|) : int -> bool option
, etc., etc.Checklist