-
Notifications
You must be signed in to change notification settings - Fork 842
[WIP] Add --disableLanguageFeature CLI switch and MSBuild property to selectively disable language features #19167
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
Draft
Copilot
wants to merge
31
commits into
main
Choose a base branch
from
copilot/add-disable-language-feature-cli
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+641
−32
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added TryParseFeature method to LanguageVersion to parse feature names from strings - Added disabledLanguageFeatures field to TcConfigBuilder to store disabled features - Added SupportsFeature method to TcConfigBuilder that checks both langVersion and disabled features - Added --disableLanguageFeature CLI option in CompilerOptions (repeatable) - Added error message for unrecognized feature names (error 3879) - Created comprehensive tests for the new functionality Co-authored-by: T-Gro <[email protected]>
- Applied fantomas formatting to modified files - Added release notes entry for the new --disableLanguageFeature CLI switch Co-authored-by: T-Gro <[email protected]>
- Modified LanguageVersion to hold disabled features and check them in SupportsFeature - Added SetDisabledFeatures method to LanguageVersion - Updated both langversion and disableLanguageFeature options to call SetDisabledFeatures - This ensures disabled features are respected regardless of option order - Applied code formatting Co-authored-by: T-Gro <[email protected]>
Copilot
AI
changed the title
[WIP] Add command line argument to disable F# language features
Add --disableLanguageFeature CLI switch to selectively disable language features
Dec 16, 2025
T-Gro
requested changes
Dec 16, 2025
Member
T-Gro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot : Read all comments
As requested, removed the SupportsFeature method from TcConfigBuilder since it's not used anywhere and is redundant - callers can directly use langVersion.SupportsFeature() Co-authored-by: T-Gro <[email protected]>
…re parsing - Changed LanguageVersion to use immutable array of disabled features instead of mutable set - Added optional constructor parameter for disabled features array - Added WithDisabledFeatures method that returns a new LanguageVersion instance - Replaced manual feature name mapping with reflection-based TryParseFeature using BindingFlags.NonPublic - Updated CompilerOptions to use immutable pattern with Array.append - Changed disabledLanguageFeatures in TcConfigBuilder from Set to array - Updated tests to use typecheck instead of compile and assert exact error codes - Applied code formatting Addresses feedback from @T-Gro about making the design immutable and using reflection. Co-authored-by: T-Gro <[email protected]>
- Added null check in TryParseFeature using Option.bind before downcasting - Changed disabledLanguageFeatures from array to Set in CompilerConfig (better semantics) - Updated CompilerOptions to use Set.add and convert to array when calling WithDisabledFeatures - Applied code formatting Addresses comments from @T-Gro about null handling and using Set in the builder. Co-authored-by: T-Gro <[email protected]>
Updated compiler_help_output.bsl to include the new --disableLanguageFeature CLI option in help output. Addresses comment from @T-Gro about updating help tests. Co-authored-by: T-Gro <[email protected]>
- Added disabledLanguageFeatures field to Fsc task - Added DisabledLanguageFeatures property (takes ITaskItem array) - Updated command line builder to pass each feature with --disableLanguageFeature flag - Follows same pattern as other MSBuild properties This allows .fsproj files to use: <DisabledLanguageFeatures>NameOf;StringInterpolation</DisabledLanguageFeatures> Partial implementation of comment 2627788945 from @T-Gro. Still need to update .targets files. Co-authored-by: T-Gro <[email protected]>
Copilot
AI
changed the title
Add --disableLanguageFeature CLI switch to selectively disable language features
Add --disableLanguageFeature CLI switch and MSBuild property to selectively disable language features
Dec 17, 2025
T-Gro
reviewed
Dec 18, 2025
Member
|
/run ilverify |
Contributor
🔧 CLI Command Report
✅ Command succeeded, no changes needed. |
…thub.com/dotnet/fsharp into copilot/add-disable-language-feature-cli
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementation Status - Debugging Complete, Baselines Updated
Working on completing the
--disableLanguageFeatureCLI switch implementation.Recent Changes:
Changes Made:
TryParseFeaturemethod using reflection with proper binding flagsdisabledLanguageFeaturesfield to TcConfigBuilder as SetLanguageVersion.SupportsFeatureto check disabled featuresWithDisabledFeaturesmethod for copy-and-update pattern (immutable design)--disableLanguageFeatureCLI option (repeatable)DisabledLanguageFeaturesMSBuild propertyTest Results:
Cache Key Analysis:
FSharpProjectOptions cache keys already handle disabled features correctly because
AreSameForCheckingcomparesOtherOptionsarrays (line 180 in FSharpCheckerResults.fs), and--disableLanguageFeature:Featureis passed via OtherOptions. No additional cache key changes needed.Next Steps:
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.