Skip to content

BUGFIX- recursive active pattern with [<return: Struct>] was not possible - #14686

Merged
abonie merged 2 commits into
dotnet:mainfrom
T-Gro:13378-struct-representations-for-partial-active-patterns-not-working-in-recursive-patterns
Feb 3, 2023
Merged

BUGFIX- recursive active pattern with [<return: Struct>] was not possible#14686
abonie merged 2 commits into
dotnet:mainfrom
T-Gro:13378-struct-representations-for-partial-active-patterns-not-working-in-recursive-patterns

Conversation

@T-Gro

@T-GroT-Gro commented Feb 2, 2023

Copy link
Copy Markdown
Member

Following code:

[<return: Struct>]let rec(|HasOne|_|)xs =match xs with|[]-> ValueNone
| h::_when h =1-> ValueSome true|_::tail ->match tail with| HasOne x -> ValueSome x
|_-> ValueNone

Was failing with:
error FS0001: The type ''a option' does not match the type 'bool voption'

This fixes it + adds more test around struct active patterns, I did not find much of them in the codebase.

@T-Gro
T-Gro requested a review from a team as a code ownerFebruary 2, 2023 16:10
…ive-patterns-not-working-in-recursive-patterns
@edgarfgp

Copy link
Copy Markdown
Contributor

Love to see this fixed . Thanks 👍

@abonie
abonie merged commit 7aa5f48 into dotnet:mainFeb 3, 2023
@T-Gro
T-Gro deleted the 13378-struct-representations-for-partial-active-patterns-not-working-in-recursive-patterns branch October 10, 2023 11:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Struct representations for partial active patterns not working in recursive patterns

5 participants

@T-Gro@edgarfgp@psfinaki@abonie@vzarytovskii