Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b5dce01
Fix Find All References for active patterns in signature files
T-Gro Jan 27, 2026
c6f5919
Fix #18270: Property rename no longer renames get/set keywords
T-Gro Jan 27, 2026
c2a22f9
Fix #18270: Apply tryFixupSpan filtering to FindUsagesService
T-Gro Jan 27, 2026
0fbd0a4
Fix operator rename issues (#14057, #17221)
T-Gro Jan 27, 2026
0570972
Add tests for single-line interface syntax FindReferences (#15399)
T-Gro Jan 27, 2026
6da3ca4
Fix #9928: Find All References works correctly with #line directives
T-Gro Jan 27, 2026
a6e0d4d
Fix symbol resolution edge cases (#5546, #4136)
T-Gro Jan 27, 2026
d0c4239
Fix: Filter non-F# files in FindFSharpReferencesAsync (#16394)
T-Gro Jan 27, 2026
d0cebb8
Fix baseline: Update Project15 test for Or pattern secondary binding …
T-Gro Jan 27, 2026
e0b117d
Fix: Find references includes record copy-and-update and DU case test…
T-Gro Jan 27, 2026
31f2288
Fix #14902: Register Item.Value for F# constructor usages
T-Gro Jan 27, 2026
91811be
Optimize Find All References for external DLL symbols (#10227)
T-Gro Jan 27, 2026
8b8bf6f
Fix Find References for C# extension methods (#16993)
T-Gro Jan 27, 2026
0d08209
Add searchable issue references to source code fixes
T-Gro Jan 27, 2026
4b2a5e7
Add missing issue references and update TASKLIST.md
T-Gro Jan 27, 2026
b143a86
Fix #5545: Add tests proving SAFE bookstore symbol finding issue is f…
T-Gro Jan 27, 2026
cd844ea
Refactor: Extract registerUnionCaseTesterIfApplicable helper (#16621)
T-Gro Jan 27, 2026
570ab36
Standardize tryFixupSpan usage in FSharp.Editor
T-Gro Jan 27, 2026
b140626
Extract reusable test helpers in FindReferences.fs
T-Gro Jan 27, 2026
b9ebb9f
Add release notes for Find All References and Rename fixes
T-Gro Jan 27, 2026
a4e5f35
Update test baselines for constructor reference changes (#14902)
T-Gro Jan 27, 2026
8bab75e
Clean up: Remove TASKLIST.md and simplify #14902 comments
T-Gro Jan 29, 2026
448bab6
Polish: Remove architecture doc and placeholder PR links
T-Gro Jan 29, 2026
6c488ab
Remove verbose comments, keep issue refs
T-Gro Jan 29, 2026
c5663a0
Extract testFindAllRefs helpers to reduce test duplication
T-Gro Jan 29, 2026
eee3339
Extract ProjectFiltering module to eliminate duplicate code
T-Gro Jan 29, 2026
4a7d221
Extract union case tester constants to PrettyNaming module
T-Gro Jan 29, 2026
82ecf78
Centralize #18270 filtering in RoslynHelpers conversion layer
T-Gro Jan 29, 2026
fe3cd21
Refactor: Move union case tester registration to property-specific layer
T-Gro Jan 29, 2026
887c986
refactor .md agentic instructions
T-Gro Feb 2, 2026
fad21a9
Merge branch 'main' into rename-fixes
T-Gro Feb 3, 2026
454e399
Fix CI build errors: correct active pattern syntax in pattern matching
T-Gro Feb 3, 2026
7324a98
Fix file ordering: move TryFSharpRangeToTextSpanForEditor to Tokenizer
T-Gro Feb 3, 2026
5d3b035
Trigger CI
T-Gro Feb 3, 2026
0b31214
Fix CI errors: complete pattern match and remove unused binding
T-Gro Feb 3, 2026
e21784d
Retrigger CI - flaky test failure in FSharp.Core.UnitTests.Control.As…
T-Gro Feb 4, 2026
e2dabad
Move ilverify-failure and release-notes from agents to skills
T-Gro Feb 4, 2026
1f6699e
Refactor #16621: Centralize union case tester registration
T-Gro Feb 4, 2026
7e545de
Fix #16621: Also register union case testers in CallMethodGroupNameRe…
T-Gro Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
504 changes: 44 additions & 460 deletions .github/agents/fsharp-generic.md

Large diffs are not rendered by default.

227 changes: 36 additions & 191 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,206 +1,51 @@
# GitHub Copilot Instructions for F# Compiler
# F# Compiler

## DEBUGGING MINDSET - CRITICAL
## Build

**Your changes are the cause until proven otherwise.**

When encountering test failures or build issues after making changes:

1. **NEVER assume "pre-existing failure"** - This is incorrect 99% of the time
2. **ALWAYS assume your PR diff caused the issue** - Even if it seems unrelated
3. **Remember the bootstrap**: The F# compiler compiles itself. If you introduced broken code in earlier commits, even if you "reverted" it later, the bootstrap compiler may be using the broken version
4. **Clean and rebuild**: When in doubt, `git clean -xfd artifacts` and rebuild from scratch to eliminate bootstrap contamination
5. **Compare your diff**: Use `git diff <base_commit> HEAD` to see ALL changes in your PR, not just the latest commit
6. **Verify with original code**: Temporarily revert your changes to confirm tests pass without them

**Forbidden phrases:**
- "pre-existing issue"
- "was already broken"
- "not related to my changes"
- "known limitation"

**Required verification before claiming something was already broken:**
1. Clean build artifacts completely
2. Checkout the base branch
3. Build and run the same test
4. Document the failure with the base branch commit hash

Only after this verification can you legitimately claim a pre-existing issue.

---

## STRUCTURE YOUR CHANGE (BEFORE EDITING)
Keep scope tight.
General guide:
- Use F#
- Target .NET Standard 2.0 for compatibility
- Avoid external dependencies – the codebase is self-contained (do NOT add new NuGet packages)
- Follow docs/coding-standards.md and docs/overview.md

**Test‑First** (bugs / regressions): Add/adjust a minimal test that fails on current main → confirm it fails → implement fix → run core command and ensure test passes → only then continue.

Plan your task:
1. Write a 1–2 sentence intent (bug fix / API add / language tweak).
2. Identify domain: Language (`LanguageFeature.fsi` touched) vs `src/FSharp.Core/` vs `vsintegration/` vs compiler/service.
3. Public API? Edit matching `.fsi` simultaneously.
4. New/changed diagnostics? Update FSComp.txt.
5. IL shape change expected? Plan ILVerify baseline update.
6. Expect baseline diffs? Plan `TEST_UPDATE_BSL=1` run.
7. Add/adjust tests in existing projects.
8. Decide release-notes sink now (Section 8).
9. Run formatting only at the end.

---

# AFTER CHANGING CODE ( Agent-only. Ubuntu only )

Always run the core command. Always verify exit codes. No assumptions.

## 1. Core Command
Default (set `BUILDING_USING_DOTNET=true` system-wide):
```bash
dotnet build <changed>.fsproj -c Debug
```
./build.sh -c Release --testcoreclr
```
Non‑zero → classify & stop.

### CRITICAL TEST EXECUTION RULES
**ALWAYS** run tests before claiming success. **NEVER** mark work complete without verified passing tests.

When running tests, **ALWAYS** report:
- Total number of tests executed
- Number passed / failed / skipped
- Execution duration
- Example: "Ran 5 tests: 5 passed, 0 failed, 0 skipped. Duration: 4.2 seconds"

**ASSUME YOUR CODE IS THE PROBLEM**: When tests fail, ALWAYS assume your implementation is incorrect FIRST. Only after thorough investigation with evidence should you consider other causes like build issues or test infrastructure problems.

**UNDERSTAND WHAT YOU'RE TESTING**: Before writing tests, understand exactly what behavior the feature controls. Research the codebase to see how the feature is actually used, not just how you think it should work.

**TEST INCREMENTALLY**: After each code change, immediately run the relevant tests to verify the change works as expected. Don't accumulate multiple changes before testing.
Get target framework: `dotnet msbuild <proj> -getProperty:TargetFrameworks`
FSharp.Core + compiler composite: `./build.sh -c Release`
FSharp.Build changes: `./build.sh -c Release`

## 2. Bootstrap (Failure Detection Only)
Two-phase build. No separate bootstrap command.
Early proto/tool errors (e.g. "Error building tools") → `BootstrapFailure` (capture key lines). Stop.
## No bullshit

## 3. Build Failure
Proto ok but solution build fails → `BuildFailure`.
Capture exit code, ≤15 error lines (`error FS`, `error F#`, `error MSB`), binlog path: `artifacts/log/Release/Build.*.binlog`.
Do not proceed to tests.
Build fails → 99% YOUR previous change broke it. You ARE the compiler.
DON'T say "pre-existing", "infra issue", "unrelated".
DO `git clean -xfd artifacts` and rebuild.
Bootstrap contamination: early commits break compiler → later "fixes" still use broken bootstrap. Clean fully.

## 4. Tests
Core command runs CoreCLR tests:
- FSharp.Test.Utilities
- FSharp.Compiler.ComponentTests
- FSharp.Compiler.Service.Tests
- FSharp.Compiler.Private.Scripting.UnitTests
- FSharp.Build.UnitTests
- FSharp.Core.UnitTests
Failures → `TestFailure` (projects + failing lines + baseline hints).
## Test

## 5. Baselines
Drift → update then re-run.
Default: `-c Debug`
Use `-c Release` for: EmittedIL tests, Optimizer tests, full component runs
spot check: `dotnet test <proj> --filter "Name~X" -c Debug`
full component: `dotnet test tests/FSharp.Compiler.ComponentTests -c Release`
IDE/service: `tests/FSharp.Compiler.Service.Tests`
VS integration: `vsintegration/` (Windows only)
update baselines: `TEST_UPDATE_BSL=1 <test command>`

General/component:
```
TEST_UPDATE_BSL=1
./build.sh -c Release --testcoreclr
```
Surface area:
```
TEST_UPDATE_BSL=1
dotnet test tests/FSharp.Compiler.Service.Tests/FSharp.Compiler.Service.Tests.fsproj --filter "SurfaceAreaTest" -c Release /p:BUILDING_USING_DOTNET=true
```
ILVerify:
```
TEST_UPDATE_BSL=1
pwsh tests/ILVerify/ilverify.ps1
```
Classify: `BaselineDrift(SurfaceArea|ILVerify|GeneralBSL)` + changed files.
## Spotcheck tests

## 6. Formatting
```
dotnet fantomas . --check
```
If fail:
```
dotnet fantomas .
dotnet fantomas . --check
```
Still failing → `FormattingFailure`.
- find new tests for bugfix/feature
- find preexisting tests in same area
- run siblings/related

## 7. Public API / IL
If new/changed public symbol (`.fsi` touched or public addition):
1. Update `.fsi`.
2. Surface area baseline flow.
3. ILVerify if IL shape changed.
4. Release notes (Section 8).
Missed baseline update → `BaselineDrift`.
## Final validation (Copilot Coding Agent only)

## 8. Release Notes (Sink Rules – Compact)
Most fixes → FSharp.Compiler.Service.
Before submitting: `./build.sh -c Release --testcoreclr`

| Condition | Sink |
|-----------|------|
| `LanguageFeature.fsi` changed | Language |
| Public API/behavior/perf change under `src/FSharp.Core/` | FSharp.Core |
| Only `vsintegration/` impacted | VisualStudio |
| Otherwise | FSharp.Compiler.Service |
## Code

Action each needed sink:
- Append bullet in latest version file under `docs/release-notes/<Sink>/`
- Format: `* Description. ([PR #NNNNN](https://github.com/dotnet/fsharp/pull/NNNNN))`
- Optional issue link before PR.
Missing required entry → `ReleaseNotesMissing`.
.fs: implementation
.fsi: declarations, API docs, context comments

## 9. Classifications
Use one or more exactly:
- `BootstrapFailure`
- `BuildFailure`
- `TestFailure`
- `FormattingFailure`
- `BaselineDrift(SurfaceArea|ILVerify|GeneralBSL)`
- `ReleaseNotesMissing`
## Rules

Schema:
```
Classification:
Command:
ExitCode:
KeySnippets:
ActionTaken:
Result:
OutstandingIssues:
```

## 10. Decision Flow
1. Format check
2. Core command
3. If fail classify & stop
4. Tests → `TestFailure` if any
5. Baseline drift? update → re-run → classify if persists
6. Public surface/IL? Section 7
7. Release notes sink (Section 8)
8. If no unresolved classifications → success summary

## 11. Success Example
```
AllChecksPassed:
Formatting: OK
Bootstrap: OK
Build: OK
Tests: Passed
Baselines: Clean
ReleaseNotes: FSharp.Compiler.Service
```

## 12. Failure Example
```
BootstrapFailure:
Command: ./build.sh -c Release --testcoreclr
ExitCode: 1
KeySnippets:
- "Error building tools"
ActionTaken: None
Result: Stopped
OutstandingIssues: Bootstrap must be fixed
```
(eof)
Public API change → update .fsi
New diagnostic → update `src/Compiler/FSComp.txt`
API surface change → `TEST_UPDATE_BSL=1 dotnet test tests/FSharp.Compiler.Service.Tests --filter "SurfaceAreaTest" -c Release`
After code changes → `dotnet fantomas .`
When fully done → write release notes (see skill)
20 changes: 20 additions & 0 deletions .github/skills/ilverify-failure/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: ilverify-failure
description: Fix ILVerify baseline failures when IL shape changes (codegen, new types, method signatures). Use when CI fails on ILVerify job.
---

# ILVerify Baseline

## When to Use
IL shape changed (codegen, new types, method signatures) and ILVerify CI job fails.

## Update Baselines
```bash
TEST_UPDATE_BSL=1 pwsh tests/ILVerify/ilverify.ps1
```

## Baselines Location
`tests/ILVerify/*.bsl`

## Verify
Re-run without `TEST_UPDATE_BSL=1`, should pass.
43 changes: 43 additions & 0 deletions .github/skills/release-notes/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: release-notes
description: Write release notes for completed changes. Use when PR modifies tracked paths and needs release notes entry.
---

# Release Notes

## Version
From GitHub repo variable `VNEXT` (e.g., `10.0.300`)
- Language: `preview.md`
- VisualStudio: `<VSMajorVersion>.vNext.md`

## Path
`docs/release-notes/.<Sink>/<Version>.md`

## Sink Mapping
- LanguageFeatures.fsi → `.Language`
- src/FSharp.Core/ → `.FSharp.Core`
- vsintegration/src/ → `.VisualStudio`
- src/Compiler/ → `.FSharp.Compiler.Service`

## Format (Keep A Changelog)
```markdown
### Fixed
* Bug fix description. ([Issue #NNN](...), [PR #NNN](...))

### Added
* New feature description. ([PR #NNN](...))

### Changed
* Behavior change description. ([PR #NNN](...))

### Breaking Changes
* Breaking change description. ([PR #NNN](...))
```

## Entry Format
- Basic: `* Description. ([PR #NNNNN](https://github.com/dotnet/fsharp/pull/NNNNN))`
- With issue: `* Description. ([Issue #NNNNN](...), [PR #NNNNN](...))`

## CI Check
PR fails if changes in tracked paths without release notes entry containing PR URL.
Add `NO_RELEASE_NOTES` label to skip.
11 changes: 11 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/10.0.300.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
### Fixed

* Fixed Find All References not correctly finding active pattern cases in signature files. ([Issue #19173](https://github.com/dotnet/fsharp/issues/19173), [Issue #14969](https://github.com/dotnet/fsharp/issues/14969), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Rename not correctly handling operators containing `.` (e.g., `-.-`). ([Issue #17221](https://github.com/dotnet/fsharp/issues/17221), [Issue #14057](https://github.com/dotnet/fsharp/issues/14057), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References not correctly applying `#line` directive remapping. ([Issue #9928](https://github.com/dotnet/fsharp/issues/9928), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed `SynPat.Or` pattern variables (non-left-most) incorrectly classified as bindings instead of uses. ([Issue #5546](https://github.com/dotnet/fsharp/issues/5546), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References not finding discriminated union types defined inside modules. ([Issue #5545](https://github.com/dotnet/fsharp/issues/5545), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed synthetic event handler values appearing in Find All References results. ([Issue #4136](https://github.com/dotnet/fsharp/issues/4136), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References not finding all usages of C# extension methods. ([Issue #16993](https://github.com/dotnet/fsharp/issues/16993), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References on discriminated union cases not including case tester properties (e.g., `.IsCase`). ([Issue #16621](https://github.com/dotnet/fsharp/issues/16621), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References on record types not including copy-and-update expressions. ([Issue #15290](https://github.com/dotnet/fsharp/issues/15290), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References on constructor definitions not finding all constructor usages. ([Issue #14902](https://github.com/dotnet/fsharp/issues/14902), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))

### Added

### Changed
Expand Down
4 changes: 4 additions & 0 deletions docs/release-notes/.VisualStudio/18.vNext.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### Fixed

* Fixed Rename incorrectly renaming `get` and `set` keywords for properties with explicit accessors. ([Issue #18270](https://github.com/dotnet/fsharp/issues/18270), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Fixed Find All References crash when F# project contains non-F# files like `.cshtml`. ([Issue #16394](https://github.com/dotnet/fsharp/issues/16394), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))
* Find All References for external DLL symbols now only searches projects that reference the specific assembly. ([Issue #10227](https://github.com/dotnet/fsharp/issues/10227), [PR #19252](https://github.com/dotnet/fsharp/pull/19252))

### Changed
2 changes: 1 addition & 1 deletion src/Compiler/Checking/AugmentWithHashCompare.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ let MakeValsForUnionAugmentation g (tcref: TyconRef) =
|> List.map (fun uc ->
// Unlike other generated items, the 'IsABC' properties are visible, not considered compiler-generated
let v =
mkImpliedValSpec g uc.Range tcref tmty vis None ("get_Is" + uc.CompiledName) (tps +-> (mkIsCaseTy g tmty)) unitArg true
mkImpliedValSpec g uc.Range tcref tmty vis None (PrettyNaming.unionCaseTesterPropertyPrefix + uc.CompiledName) (tps +-> (mkIsCaseTy g tmty)) unitArg true

g.AddValGeneratedAttributes v m
v)
Expand Down
4 changes: 2 additions & 2 deletions src/Compiler/Checking/CheckPatterns.fs
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ and TcPatBindingName cenv env id ty isMemberThis vis1 valReprInfo (vFlags: TcPat

// isLeftMost indicates we are processing the left-most path through a disjunctive or pattern.
// For those binding locations, CallNameResolutionSink is called in MakeAndPublishValue, like all other bindings
// For non-left-most paths, we register the name resolutions here
// For non-left-most paths, we register the name resolutions here as Use, not Binding (#5546)
if not isLeftMost && not vspec.IsCompilerGenerated && not (vspec.LogicalName.StartsWithOrdinal("_")) then
let item = Item.Value(mkLocalValRef vspec)
CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Binding, env.AccessRights)
CallNameResolutionSink cenv.tcSink (id.idRange, env.NameEnv, item, emptyTyparInst, ItemOccurrence.Use, env.AccessRights)

PatternValBinding(vspec, typeScheme)

Expand Down
Loading
Loading