Skip to content

Conversation

@dawedawe
Copy link
Contributor

@dawedawe dawedawe commented Feb 7, 2024

Description

This fixes the issue shown in this PR

As @0101 said, we need FSharpDiagnosticOptions depending on the ParsedInput of a file. But we loose that pretty deep in the call stack. Instead of changing returns all over the place, this PR makes use of the cached FSharpParsedFile to fix this.
I hope this is an acceptable tradeoff to move the TransparentCompiler forward.

(I don't think this needs release notes)

Checklist

  • Test cases added

  • Performance benchmarks added in case of performance changes

  • Release notes entry updated:

    Please make sure to add an entry with short succinct description of the change as well as link to this pull request to the respective release notes file, if applicable.

    Release notes files:

    • If anything under src/Compiler has been changed, please make sure to make an entry in docs/release-notes/.FSharp.Compiler.Service/<version>.md, where <version> is usually "highest" one, e.g. 42.8.200
    • If language feature was added (i.e. LanguageFeatures.fsi was changed), please add it to docs/releae-notes/.Language/preview.md
    • If a change to FSharp.Core was made, please make sure to edit docs/release-notes/.FSharp.Core/<version>.md where version is "highest" one, e.g. 8.0.200.

    Information about the release notes entries format can be found in the documentation.
    Example:

    If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

@dawedawe dawedawe requested a review from a team as a code owner February 7, 2024 17:06
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2024

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@0101
Copy link
Contributor

0101 commented Feb 7, 2024

If we can fix it like this then why not!

But some diagnostics refactoring might be needed eventually. We're already processing them with this config applied in ComputeTcIntermediate:

let tcConfig =
ApplyNoWarnsToTcConfig(tcConfig, parsedMainInput, Path.GetDirectoryName mainInputFileName)
// update the error handler with the modified tcConfig
errHandler.DiagnosticOptions <- tcConfig.diagnosticsOptions
let diagnosticsLogger = errHandler.DiagnosticsLogger

Maybe it's possible to somehow make use of that.

@majocha
Copy link
Contributor

majocha commented Feb 7, 2024

Maybe this code could work in the Finisher in processGraphNode?

@dawedawe
Copy link
Contributor Author

dawedawe commented Feb 8, 2024

The last push is just to correct the first approach taken.
I'm looking into a better way to do this deeper in the callstack.

@nojaf nojaf added the NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes label Feb 8, 2024
@dawedawe
Copy link
Contributor Author

dawedawe commented Feb 8, 2024

Maybe it's possible to somehow make use of that.

Thanks for the pointer. I think we are good now.

@0101
Copy link
Contributor

0101 commented Feb 8, 2024

Huh, looks like it was close 😀

Maybe this code could work in the Finisher in processGraphNode?

That would make sense if we need some prior state for the processing. But probably we're fine at this stage just with proper filtering and formatting can still happen at the end when we're creating the result.

@dawedawe
Copy link
Contributor Author

dawedawe commented Feb 8, 2024

Huh, looks like it was close 😀

Oh yeah, just a little shake and shuffle was needed :)

@0101
Copy link
Contributor

0101 commented Feb 8, 2024

@dawedawe do you think you could temporarily trigger the tests in CI again? To see if this had any unexpected effects.

We really need the tests auto-enabled in main, I'll try to set it up here: #16591

@dawedawe
Copy link
Contributor Author

dawedawe commented Feb 8, 2024

Mmh, some expected Information diagnostics are reported as Warning diagnostics.
I'll look into that tomorrow.

@0101
Copy link
Contributor

0101 commented Feb 9, 2024

The tests are now in main so you can undo dawedawe@b47ba47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants