Skip to content

Commit dbf4c92

Browse files
authored
Create copilot-instructions.md (#18490)
1 parent 394083c commit dbf4c92

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/copilot-instructions.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# GitHub Copilot Instructions for F# Compiler
2+
3+
## Language and Environment
4+
- Use modern F# with functional-first approach
5+
- Target .NET Standard 2.0 for compatibility
6+
- Avoid external dependencies - the codebase is self-contained
7+
8+
## Code Style and Standards
9+
- Follow [coding standards](docs/coding-standards.md), especially:
10+
- Prefer immutability and pure functions
11+
- Use consistent naming (see abbreviation guide)
12+
- Process complex types recursively with pattern matching
13+
- Avoid single-character identifiers except in established patterns
14+
- This project uses .fsi signature files. When adding a new public API to a namespace/module which will be consumed from other file, add it to the respective .fsi signature file as well
15+
- Follow [overview](docs/overview.md) for key compiler data formats and representations
16+
17+
## Type System Handling
18+
- When working with `TType` instances, use appropriate stripping functions:
19+
- `stripTyparEqns` - Removes inference equations from type parameters
20+
- `stripTyEqns` - Removes type equations and type abbreviations
21+
- `stripTyEqnsAndErase` - Also erases compilation representations
22+
- Match the appropriate stripper to the context (e.g., display vs compilation)
23+
- Check equality with `typeEquiv` after stripping rather than direct comparison
24+
25+
## Core Data Structures
26+
- Use F# discriminated unions for type representations
27+
- Respect representation hiding through access control
28+
- Use `remapX` functions when transforming types across boundaries
29+
- Be aware of performance implications for recursive type operations
30+
31+
## Documentation and Naming
32+
- Document public APIs with XML comments
33+
- Use descriptive function names that indicate transformation direction
34+
- Follow established naming conventions in error messages

0 commit comments

Comments
 (0)