Reject non-function bindings for single-case and partial active pattern names#19763
Draft
Copilot wants to merge 4 commits into
Draft
Reject non-function bindings for single-case and partial active pattern names#19763Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Agent-Logs-Url: https://github.com/dotnet/fsharp/sessions/588bbe30-9352-45a1-8895-c59b79395ad3 Co-authored-by: T-Gro <46543583+T-Gro@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix compiler allowing non-functions as active pattern names
Reject non-function bindings for single-case and partial active pattern names
May 18, 2026
The PR's new validation rejects non-function active pattern bindings for single-case and partial patterns (extending the existing multi-case check). The RelaxWhitespace2.fs test file had several active patterns defined as non-function values (|C|, |F|_|, |G|_|, etc.) since it tests whitespace relaxation, not active pattern semantics. Add parameters to make these active patterns function-typed while preserving the multiline whitespace structure being tested. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
❗ Release notes required
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
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.
The compiler previously rejected non-function multi-case active patterns (
(|A|B|)) but still allowed equivalent invalid forms for single-case ((|A|)) and partial ((|A|_|)) names. This left declarations that tooling recognized as active patterns but could not be used in pattern positions.Checker behavior aligned across active pattern forms
Active pattern '...' is not a function) consistently apply to single-case and partial declarations as well.Conformance coverage expanded
E_ActivePatternNotAFunction.fswith explicit single-case and partial non-function declarations.Named.fsto assert all three FS1209 errors.Example of newly-rejected declarations