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>)
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
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
type T = T<int>)