Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 15, 2025

  • Understand the current documentation structure
  • Review the examples provided by the subject matter expert
  • Enhance the "Patterns That Have Type Annotations" section with better explanation
  • Enhance the "Type Test Pattern" section with better explanation and contrast
  • Add contrasting examples that clearly show the difference
  • Test that all code examples compile correctly
  • Apply code review suggestions (formatting and lint fixes)
  • Add ai-usage frontmatter metadata

Summary of Changes

Enhanced the F# pattern matching documentation to clearly contrast between:

  1. Pattern That Has Type Annotation (pattern : type):

    • Added explanation that it provides compile-time type information
    • Clarified it doesn't perform runtime type checking
    • Added key characteristics list
  2. Type Test Pattern (:? type):

    • Added explanation that it performs runtime type checking
    • Clarified similarity to C#'s is or as operators
    • Added key characteristics list
  3. New Contrasting Section:

    • Added a comparison table showing syntax, timing, purpose, and C# equivalents
    • Included side-by-side code examples demonstrating the difference
    • Made it clear that type annotation is compile-time while type test is runtime

All code examples have been verified to compile successfully with F# 9.0.

Applied formatting fixes per code review and added required ai-usage: ai-assisted frontmatter metadata.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.


Internal previews

📄 File 🔗 Preview link
docs/fsharp/language-reference/pattern-matching.md docs/fsharp/language-reference/pattern-matching

@dotnet-policy-service dotnet-policy-service bot added the okr-quality Content-quality KR: Concerns article defects (bugs), freshness, or build warnings. label Oct 15, 2025
@Copilot Copilot AI changed the title [WIP] Elucidate contrast between type annotations and test type pattern Clarify difference between type annotation and type test patterns in F# documentation Oct 15, 2025
@Copilot Copilot AI requested a review from BillWagner October 15, 2025 12:51
Copilot finished work on behalf of BillWagner October 15, 2025 12:51
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 once I apply suggestions

@BillWagner BillWagner marked this pull request as ready for review October 15, 2025 21:04
@BillWagner BillWagner requested review from a team as code owners October 15, 2025 21:04
@Copilot Copilot AI review requested due to automatic review settings October 15, 2025 21:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR clarifies the distinction between type annotation patterns and type test patterns in F# pattern matching documentation. These syntactically similar patterns serve fundamentally different purposes—compile-time type inference vs. runtime type checking—which was causing reader confusion.

Key changes:

  • Enhanced explanations for both pattern types with clear compile-time vs. runtime distinctions
  • Added a new comparison section with side-by-side examples and a feature comparison table
  • Added C# equivalents to make concepts more accessible to developers from other .NET languages

Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

This is ready once I apply suggestions

All suggestions have been applied in commit e0e0ee0.

@Copilot Copilot AI requested a review from BillWagner October 16, 2025 12:32
Copilot finished work on behalf of BillWagner October 16, 2025 12:32
Copy link
Member

@IEvangelist IEvangelist left a comment

Choose a reason for hiding this comment

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

Missing frontmatter/metadata.

Copy link
Contributor Author

Copilot AI commented Oct 16, 2025

Missing frontmatter/metadata.

Added ai-usage: ai-assisted frontmatter in commit 7f8a73e.

Copilot finished work on behalf of BillWagner October 16, 2025 14:33
@IEvangelist IEvangelist self-requested a review October 16, 2025 14:40
@BillWagner BillWagner merged commit f89ea8f into main Oct 16, 2025
17 checks passed
@BillWagner BillWagner deleted the copilot/contrast-type-annotations-and-patterns branch October 16, 2025 14:58
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.

3 participants