Skip to content

Remove ML compatibility#19143

Merged
T-Gro merged 27 commits intodotnet:mainfrom
kerams:ml
Jan 8, 2026
Merged

Remove ML compatibility#19143
T-Gro merged 27 commits intodotnet:mainfrom
kerams:ml

Conversation

@kerams
Copy link
Copy Markdown
Contributor

@kerams kerams commented Dec 8, 2025

Description

Implements fsharp/fslang-suggestions#1407

  • Released keywords asr, land, lor, lsl, lsr, lxor (mod continues to be reserved)
  • Hidden or and & operators in FSharp.Core for binary compatibility
  • The ^ string concatenation operator in FSharp.Core has been marked as obsolete (with IsError = true)
  • Removed support for .ml and .mli source files
  • Removed #light and #indent directives (they are now a no-op, combined with "off" they give an error)
  • Removed --light, --indentation-syntax, --no-indendation-syntax, --ml-keywords and --mlcompatibility compiler/fsi flags
  • Removed parsing support for deprecated ML (non-light) constructs, meaning there's no longer any ML specific warning or error (the only exception is parenthesized dot get, which gives a construct removed error)
  • Removed ML compatibility tests
    • The changes in other test files only include removing #light from source code. There are hundreds of these files, but they can be safely skipped during review

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/release-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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Dec 8, 2025

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/FSharp.Core docs/release-notes/.FSharp.Core/10.0.200.md

Copy link
Copy Markdown
Member

@auduchinok auduchinok left a comment

Choose a reason for hiding this comment

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

Thanks for this @kerams!

What do you think about keeping the parser rules and just always producing the errors? We could easily remove them in future if wanted to repurpose these constructs in the language. For now keeping them would allow to parse older code which could be nice as long as it doesn't need maintenance in the parser.

@kerams
Copy link
Copy Markdown
Contributor Author

kerams commented Dec 8, 2025

What do you think about keeping the parser rules and just always producing the errors?

That's been the case since ML compatibility was deprecated. The only way to get rid of it was the combination of the 2 flags. We could keep the parser rules, but one of the benefits of doing this was a slight parser/lexer simplication, and I'm not sure what would be the practical benefit of preserving them.

@auduchinok
Copy link
Copy Markdown
Member

We could keep the parser rules, but one of the benefits of doing this was a slight parser/lexer simplication, and I'm not sure what would be the practical benefit of preserving them.

I think keeping the simple rules that don't require any additional support (like the type arguments in parens) would be beneficial. I see it as a sort-of error recovery rules.

@T-Gro
Copy link
Copy Markdown
Member

T-Gro commented Dec 8, 2025

Yes, long term code simplification should be the motivator here, since the rules were there but obsolete for many years.
Old SDKs/nugets will continue to work if anyone wishes to parse F# files which are out of support.

(and it is always possible to e.g. copy existing parser rules+code and build a dedicated "ML-style-syntax-tree nuget" with it.)

@kerams

This comment was marked as outdated.

@T-Gro
Copy link
Copy Markdown
Member

T-Gro commented Dec 11, 2025

because of FSharp.Core conflicts

Is it because of the changes this PR did?
Right now I cannot see why the bootstrap process via build scripts should complain, but maybe I overlooked a change.

@kerams

This comment was marked as outdated.

@kerams

This comment was marked as outdated.

@auduchinok
Copy link
Copy Markdown
Member

What the hell is this?

@kerams It looks similar to #15908.

@kerams
Copy link
Copy Markdown
Contributor Author

kerams commented Dec 12, 2025

Added. I just throw on <8, there's no SDK <-> language version matrix. An exercise for someone else down the line;)

"Language version '%s' is out of support. The last .NET SDK supporting it is available at https://dotnet.microsoft.com/en-us/download/dotnet/%s"

I know it would be more accurate to say that features in version %s have become part of core F# and are always enabled, but that specifically doesn't apply to ML compatibility. Feel free to change it however you see fit.

@T-Gro
Copy link
Copy Markdown
Member

T-Gro commented Dec 14, 2025

The wording is good, thanks for adding that 👍 .

I am also thinking about building an unsupported (= not officially shipped) .vsix right before this change and uploading it to people in case they need to maintain such an unsupported codebase. But I can do that JIT when/if the request comes at all.

(reasoning is that pre-change tooling will be better in migrating the codebase, since it will give more accurate warnings)

T-Gro added a commit to T-Gro/FsLexYacc that referenced this pull request Dec 15, 2025
Copy link
Copy Markdown
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 contribution simplifies the compiler codebase, especially the lexer and parser.

Big thank you to @kerams for starting the activity of stabilizing the "core of F# language" by reducing the number of supported versions, and taking the largest language feature by far!

I added a few minor comments only.

@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Dec 15, 2025
@T-Gro T-Gro requested a review from Copilot December 15, 2025 15:11

This comment was marked as off-topic.

@T-Gro T-Gro merged commit b5342c4 into dotnet:main Jan 8, 2026
39 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in F# Compiler and Tooling Jan 8, 2026
@kerams kerams deleted the ml branch January 8, 2026 08:44
T-Gro added a commit that referenced this pull request Mar 31, 2026
Verifies that land, lor, lxor, lsl, lsr, and asr can be used as valid
identifiers after the ML compatibility removal in PR #19143.

Fixes #6715

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
T-Gro added a commit that referenced this pull request Mar 31, 2026
Verifies that land, lor, lxor, lsl, lsr, and asr can be used as valid
identifiers after the ML compatibility removal in PR #19143.

Fixes #6715

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI pushed a commit that referenced this pull request Mar 31, 2026
Verifies that land, lor, lxor, lsl, lsr, and asr can be used as valid
identifiers after the ML compatibility removal in PR #19143.

Fixes #6715

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
Copilot AI pushed a commit that referenced this pull request Mar 31, 2026
Verifies that land, lor, lxor, lsl, lsr, and asr can be used as valid
identifiers after the ML compatibility removal in PR #19143.

Fixes #6715

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
Copilot AI pushed a commit that referenced this pull request Mar 31, 2026
Verifies that land, lor, lxor, lsl, lsr, and asr can be used as valid
identifiers after the ML compatibility removal in PR #19143.

Fixes #6715

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: abonie <20281641+abonie@users.noreply.github.com>
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.

6 participants