Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

Fixes #[issue_number]

This PR addresses the missing documentation for predefined compiler symbols that the F# compiler and build system automatically define. Users were unclear about which symbols (like DEBUG) are automatically available for conditional compilation.

Changes

Added a comprehensive "Predefined symbols" section to the F# compiler directives documentation that covers:

Build configuration symbols

  • DEBUG: Automatically defined in Debug builds, used with assertions and diagnostic code
  • TRACE: Defined for builds with tracing enabled

Compilation mode symbols

  • COMPILED: Defined when compiling with the F# compiler
  • INTERACTIVE: Defined when running in F# Interactive (dotnet fsi)

Target framework symbols

  • Includes the full table of framework symbols (e.g., NET6_0_OR_GREATER, NETSTANDARD2_0, etc.) via the existing preprocessor-symbols.md include file

The documentation includes practical examples and cross-references to related topics (Assertions, F# Interactive, and compiler options). This brings the F# documentation in line with the C# preprocessor directives documentation structure.

Related

Original prompt

This section details on the original issue you should resolve

<issue_title>Include all predefined symbols</issue_title>
<issue_description>### Type of issue

Missing information

Description

This content is helpful, but it would also help if there was some documentation of define symbols that the compiler automatically defines. For example, it seems the compiler automatically defines DEBUG in a debug build. Are there other automatically defined symbols?

Page URL

https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/compiler-directives

Content source URL

https://github.com/dotnet/docs/blob/main/docs/fsharp/language-reference/compiler-directives.md

Document Version Independent Id

4b909519-f78c-b250-c31e-b55e2f31237c

Platform Id

f462146f-9259-6295-0047-f637481cc2b3

Article author

@KathleenDollard

Metadata

  • ID: fcdbc5c2-c915-3ec8-ae1d-6ce0fbd050ed
  • PlatformId: f462146f-9259-6295-0047-f637481cc2b3
  • Service: dotnet-fsharp

Related Issues</issue_description>

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

@BillWagner For the correct fix, see https://github.com//pull/45607#discussion_r2039219346

Fixes #45478


💡 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/compiler-directives.md docs/fsharp/language-reference/compiler-directives

Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Co-authored-by: BillWagner <493969+BillWagner@users.noreply.github.com>
Copilot AI changed the title [WIP] Include documentation for all predefined symbols Document predefined compiler symbols in F# compiler directives Oct 21, 2025
Copilot AI requested a review from BillWagner October 21, 2025 13:59
Copilot finished work on behalf of BillWagner October 21, 2025 13:59
@BillWagner BillWagner marked this pull request as ready for review October 22, 2025 12:35
@BillWagner BillWagner requested review from a team as code owners October 22, 2025 12:35
@Copilot Copilot AI review requested due to automatic review settings October 22, 2025 12:35
Copy link
Contributor

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 adds comprehensive documentation for predefined compiler symbols in F# compiler directives, addressing a documentation gap where users were unclear about automatically defined symbols like DEBUG.

Key Changes:

  • Added a new "Predefined symbols" section documenting build configuration symbols (DEBUG, TRACE), compilation mode symbols (COMPILED, INTERACTIVE), and target framework symbols
  • Included practical code examples showing how to use these symbols in conditional compilation
  • Added cross-references to related documentation (Assertions, F# Interactive, compiler options)

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 LGTM, and is ready for final review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include all predefined symbols

2 participants