Skip to content

[Regression] Static extension 'get' or 'set' accessor on generic type not resolved when the other is intrinsic #19797

@evgTSV

Description

@evgTSV

Similar to the issue reported in #19664 regarding static methods, the F# compiler fails to resolve a static setter defined in a type extension for a generic type

Repro steps

module Lib =
    
    type Label<'T> =
        static member Text with get() = "Static Intrinsic"
        
    [<AutoOpen>]
    module Utils =
        type Label<'T> with
            static member Text with set (v) = printfn "Extension"

module Program =
    open Lib

    Label<int>.Text <- "Text" // regressed: extension setter

Expected behavior

The compiler should merge the intrinsic getter and extension setter, allowing the property to be used as read-write.

Actual behavior

Compiler treats the property as read-only and fails with a error FS0810: Property 'Text' cannot be set.

Known workarounds

  • Move extension to same module as type
  • Rename extension
  • You can just create an aliase (eg. type T = T<int>)

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions