Skip to content

Codegen issue w.r.t. DefaultAugmentation(false) #16565

Open
@vzarytovskii

Description

@vzarytovskii

Given the following code:

open System
[<DefaultAugmentation(false)>]
type Option<'T> =
    | Some of Value: 'T
    | None
 
    member x.Value =
        match x with
        | Some x -> x
        | None -> raise (new InvalidOperationException("Option.Value"))
 
    static member None : Option<'T> = None
and 'T option = Option<'T>

When compiling or pasted to FSI, produces the following issue:

Error in pass2 for type ..., error: duplicate entry 'get_None' in method table

Removing DefaultAugmentation attribute and static member None resolves the issue.

Interestingly enough, this is roughly how FSharpOption is defined in fslib, it also fails to compile in fsi, but not in product compiler apparently.

If it's a regression, then it's a fairly old one, SharpLab shows it and they use F# 6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Compiler-CodeGenIlxGen, ilwrite and things at the backendArea-Diagnosticsmistakes and possible improvements to diagnosticsBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions