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

Remove FSharpProjectOptions from Transparent Compiler check results #18205

Merged
merged 6 commits into from
Jan 21, 2025

Conversation

0101
Copy link
Contributor

@0101 0101 commented Jan 6, 2025

Description

Proper fix for #16979

FSharpProjectOptions is part of the public API, however it might be ok to not have it if you use the new experimental API which relies on snapshots instead. We could also add FSharpProjectSnapshot to the ProjectContext. But the user has to have it in order to request the result, so maybe we can just leave it up to them to hold it if they need it later...

Checklist

  • Test cases added
  • Performance benchmarks added in case of performance changes
  • Release notes entry updated

Copy link
Contributor

github-actions bot commented Jan 6, 2025

❗ 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

Copy link
Member

@T-Gro T-Gro left a comment

Choose a reason for hiding this comment

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

This change only affects internal APIs, right?

@0101
Copy link
Contributor Author

0101 commented Jan 7, 2025

This change only affects internal APIs, right?

No. With this change, if you use Transparent Compiler to get FSharpCheckFileResults and then you do .ProjectContext.ProjectOptions you'll get an exception.

But if you use the default BackgroundCompiler it keeps working as before.

I think this is ok, since TC is marked as experimental.

But eventually we should probably change the public API. Not sure what the point of options being accessible there is anyway.

@0101
Copy link
Contributor Author

0101 commented Jan 7, 2025

Another thing is that currently it might already be possible to get an exception requesting ProjectContext under some circumstances:

member _.ProjectContext =
match details with
| None -> failwith "not available"
| Some(scope, _builderOpt) ->

@0101
Copy link
Contributor Author

0101 commented Jan 20, 2025

I added a better message in the exception in case some one does run into it.

I think we can merge it. It should provide a small perf improvement for Transparent Compiler users since we don't have to construct the options at all.

@0101 0101 marked this pull request as ready for review January 20, 2025 12:17
@0101 0101 requested a review from a team as a code owner January 20, 2025 12:17
@psfinaki
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@0101
Copy link
Contributor Author

0101 commented Jan 21, 2025

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@0101 0101 merged commit 9800899 into dotnet:main Jan 21, 2025
33 checks passed
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