Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 2, 2025

Summary

Fixes #bcf94eb4 by correcting the syntax documentation for F# properties to show the proper positioning of attributes on get and set accessors.

Problem

The F# property syntax documentation had two issues:

  1. Main syntax (combined get/set with with/and keywords) didn't show that attributes can be applied individually to get and set accessors, even though the language supports this.

  2. Alternative syntax (separate get and set member declarations) showed attributes in the wrong position - they were placed before the member keyword instead of before the get()/set keywords where they should actually be applied.

Changes

Updated the syntax blocks in docs/fsharp/language-reference/members/properties.md:

Main syntax - Added accessor-specific attributes:

// Before
with [accessibility-modifier] get() =
and [accessibility-modifier] set parameter =

// After  
with [ attributes-for-get ] [accessibility-modifier] get() =
and [ attributes-for-set ] [accessibility-modifier] set parameter =

Alternative syntax - Fixed attribute positioning:

// Before
[ attributes-for-get ]
[ static ] member [accessibility-modifier-for-get] [self-identifier.]PropertyName =
    get-function-body
[ attributes-for-set ]
[ static ] member [accessibility-modifier-for-set] [self-identifier.]PropertyName
with set parameter =
    set-function-body

// After
[ static ] member [accessibility-modifier-for-get] [self-identifier.]PropertyName
with [ attributes-for-get ] get() =
    get-function-body
[ static ] member [accessibility-modifier-for-set] [self-identifier.]PropertyName
with [ attributes-for-set ] set parameter =
    set-function-body

Also updated get-only and set-only alternative syntaxes for consistency.

Verification

  • ✅ Changes align with F# language specifications as demonstrated in the SharpLab examples referenced in the issue
  • ✅ Markdownlint validation passed with 0 errors
Original prompt

This section details on the original issue you should resolve

<issue_title>Syntax for properties can be improved in terms of attributes for get and set</issue_title>
<issue_description>1. Main syntax (first one) lacks [ attributes-for-get ] and [ attributes-for-set ], though it definitely supports them.
2. Alternative syntax (second one) mentions the same [ attributes-for-get ] and [ attributes-for-set ] but in wrong positions. Because attributes would be applied to property or... ehh, lost completely?
But this way everything works.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Comments on the Issue (you are @copilot in this section)

Fixes #24063

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/fsharp/language-reference/members/properties.md docs/fsharp/language-reference/members/properties

@dotnet-policy-service dotnet-policy-service bot added okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. labels Oct 2, 2025
Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Syntax for properties can be improved in terms of attributes for get and set Fix F# property syntax documentation for attribute positioning Oct 2, 2025
@Copilot Copilot AI requested a review from BillWagner October 2, 2025 13:06
Copilot finished work on behalf of BillWagner October 2, 2025 13:06
Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is ready for final review.

@BillWagner BillWagner marked this pull request as ready for review October 2, 2025 17:49
@BillWagner BillWagner requested review from a team as code owners October 2, 2025 17:49
@BillWagner BillWagner requested a review from IEvangelist October 2, 2025 17:49
@T-Gro T-Gro merged commit d19e83b into main Oct 3, 2025
13 checks passed
@T-Gro T-Gro deleted the copilot/fix-bcf94eb4-c949-4a1d-b859-90e688aaea2d branch October 3, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dotnet-fsharp/svc okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Syntax for properties can be improved in terms of attributes for get and set
3 participants