Skip to content

Conversation

@T-Gro
Copy link
Member

@T-Gro T-Gro commented Feb 2, 2023

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 owner February 2, 2023 16:10
…ive-patterns-not-working-in-recursive-patterns
@edgarfgp
Copy link
Contributor

edgarfgp commented Feb 2, 2023

Love to see this fixed . Thanks 👍

@abonie abonie merged commit 7aa5f48 into dotnet:main Feb 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 free to join this conversation on GitHub. Already have an account? Sign in to comment

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