Skip to content
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

Field in a record named the same as a DUs case inside of module of the same name of the record type fails to pattern match #18364

Open
MangelMaxime opened this issue Mar 6, 2025 · 0 comments

Comments

@MangelMaxime
Copy link
Contributor

Hello

Repro steps

Provide the steps required to reproduce the problem:

module Test =

    type Configuration = 
        {
            Parameters : string list
        }

    module Configuration =

        type Parameters = Parameters of int list

let echo (value : Test.Configuration.Parameters) =
    match value with
    | Test.Configuration.Parameters i -> i

Image

Expected behavior

Should not confuse the types

Actual behavior

Type confusion is occuring

Known workarounds

  1. Changing either name of the record property or the DUs case fix the issue.

  2. Using an alias, for accessing the DUs:

module Test =

    
    type Configuration = 
        {
            // Changing this property name fix the issue
            Parameters : string list 
        }
    
    module Configuration =

        type Parameters = Parameters of int list

type P = Test.Configuration.Parameters

let echo (value : Test.Configuration.Parameters) =
    match value with
    | P.Parameters i -> i

Related information

Provide any related information (optional):

  • Operating system: Windows_NT
  • Runtime: netcore
  • Dotnet version: 9.0.103
  • VSCode: 1.97.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

1 participant