-
Notifications
You must be signed in to change notification settings - Fork 847
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
F# allows to declare get and set parts of property separately and in any order, like so
member _.A with get () = internalValue
member _.A with set (value) = internalValue <- valueHowever, attributes that are defined on second part (get or set, doesn't matter) are ignored.
Repro steps
- Create project with the following code or use sharplab:
type Foo() =
let mutable internalValue = 1
member _.A with get () = internalValue
[<System.Obsolete>] member _.A with set (v: int) = internalValue <- v- Compile and observe IL
Expected behavior
Property A is marked as obsolete or compiler warning if current behavior is intentional.
Actual behavior
Property A is not obsolete. Attribute is missing from IL.
Known workarounds
Combined syntax member _.Prop with get () = 1 and set (v: int) = () or attribute on first method of property.
Related information
dotnet version: 5.0.202
ForNeVeR
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
Done