Skip to content
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

Improve active pattern error reporting #17666

Merged

Conversation

edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Sep 4, 2024

Description

Active patterns errors are currently reported using the RHS expr, with can lead to:

  • Inaccurate error ranges
  • Hiding other errors
  • Overall bad user experience

I propose we use the LHS pat range to make this more accurate.

Active patterns cannot return more than 7 possibilities

Before

Screenshot 2024-09-04 at 19 58 03

After

let (|A|B|C|D|E|F|G|H|) x =
     ^^^^^^^^^^^^^^^^^
    match x with
    | 0 -> A
    | 1 -> B
    | 2 -> C
    | 3 -> D
    | 4 -> E
    | 5 -> F
    | 6 -> G
    | _ -> H

Checklist

  • Test cases added
  • Release notes entry updated

@edgarfgp edgarfgp requested a review from a team as a code owner September 4, 2024 19:08
Copy link
Contributor

github-actions bot commented Sep 4, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/9.0.100.md

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Sep 4, 2024

Should be merged after #17601

@vzarytovskii vzarytovskii merged commit 7bfdd73 into dotnet:main Sep 6, 2024
30 checks passed
@vzarytovskii
Copy link
Member

Nice, thanks

Copy link
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

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

Nice changes @edgarfgp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants