Skip to content

Conversation

@edgarfgp
Copy link
Contributor

@edgarfgp edgarfgp commented Sep 8, 2024

Description

  • Improves the error range for use! may not be combined with and!
  • Updates SynExprAndBangTrivia to include also AndBangKeyword range
  • Uses only the and! range since it's what adds the error in the first place.

Before

Screenshot 2024-09-08 at 16 32 46

After

let run r2 r3 =
    result {
        use! b = r2
        and! c = r3
        ^^^^
        return b - c
    }

Checklist

  • Test cases added
  • Release notes entry updated

@edgarfgp edgarfgp requested a review from a team as a code owner September 8, 2024 15:35
@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 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

@auduchinok
Copy link
Member

@edgarfgp Could it be better to highlight the and! part, since it's what adds the error? Could it also highlight the keyword only?

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Sep 8, 2024

Could it be better to highlight the and! part, since it's what adds the error? Could it also highlight the keyword only?

Yeah I think that makes more sense. Thanks for the review.

Update: Unfortunately there is not a dedicated range for only the and keyword. So the best we can do for now if the expression range. See fantomas

@edgarfgp
Copy link
Contributor Author

edgarfgp commented Sep 8, 2024

@auduchinok I played around with your suggestion and I was able to update SynExprAndBangTrivia to also include and! range.

@edgarfgp edgarfgp closed this Sep 8, 2024
@edgarfgp edgarfgp reopened this Sep 8, 2024
Copy link
Contributor

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

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

Good stuff, I like this approach with adding trivia. Thanks for making diags better every week :)

@edgarfgp
Copy link
Contributor Author

@psfinaki I have more planned for CE in the upcoming weeks

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.

5 participants