Skip to content

Scoped nowarn #18049

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

Merged
merged 137 commits into from
May 14, 2025
Merged

Scoped nowarn #18049

merged 137 commits into from
May 14, 2025

Conversation

Martin521
Copy link
Contributor

@Martin521 Martin521 commented Nov 22, 2024

Description

Implements Scoped Nowarn according to draft RFC FS-1146.

This PR has taken a while. I had to deal with much more complexity than I imagined when I naively volunteered to tackle the feature request. Anyway, here we are.

I have split the PR into 7 commits that can be reviewed in sequence.
All of them compile, 1 and 4 - 7 also pass all tests locally.

  1. Add the feature flag, baseline tests, and the core WarnScopes module. See src/Compiler/SyntaxTree/WarnScopes.fsi and the RFC for the functionality of the module.

  2. Add the necessary changes to lexing and parsing. Note that the warn directives can no longer be collected during parsing (since they can now appear not only in top-level modules, but anywhere). So we collect them during lexing, similar to the processing of #if/#else/#endif directives.

  3. Remove legacy #nowarn processing (but hold off AST changes)

  4. Integrate the WarnScopes functionality and test it

  5. Add warn directive trivia (but hold off AST changes)

  6. Enable warn directive trivia (which means AST changes)

  7. Remove defunct types and parameters related to former #nowarn processing (more AST changes)

There is also a separate commit for the IlVerify baseline updates (change in line numbers only)

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated
  • Create documentation update PRs (see RFC)

@Martin521 Martin521 requested a review from a team as a code owner November 22, 2024 08:58
Copy link
Contributor

github-actions bot commented Nov 22, 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.300.md
LanguageFeatures.fsi docs/release-notes/.Language/preview.md

@psfinaki
Copy link
Member

Hi @Martin521 - thanks for the contribution. It's a substantial effort and we appreciate it. The PR is on our radar - just keep in mind that it's big and specific, and it will take time to find capacity for it.

If anyone from the community gets to thoroughly review it, that would be valuable as well.

Thanks for your diligence and patience :)

@Martin521
Copy link
Contributor Author

@T-Gro
Can this be merged? Or is there anything I can still do here?

@T-Gro
Copy link
Member

T-Gro commented May 14, 2025

@T-Gro Can this be merged? Or is there anything I can still do here?

It can be merged, now just waiting for a second tick from other maintainers. I asked offline to give it, expect it to be merged soon.

@T-Gro T-Gro enabled auto-merge (squash) May 14, 2025 07:36
@T-Gro T-Gro merged commit 66e1637 into dotnet:main May 14, 2025
33 checks passed
@Thorium
Copy link
Contributor

Thorium commented May 14, 2025

987 files changed, a huge thing! :-D
Now that the WarnDirectives are carried across, would it be possible for TypeProviders to raise warnings in addition to errors?

@kerams
Copy link
Contributor

kerams commented May 14, 2025

@Thorium, #14483 - there was no interest from powers that be

(And thanks for this PR by the way :P)

@psfinaki
Copy link
Member

Well done @Martin521! Your persistence here was exemplary - great job :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking-change Describes a bug which is also a breaking change. needs-breaking-change-doc-created A PR needs a doc entry describing a new breaking change
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

10 participants