Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1799aaf
make attribute targets mismatches a warning and not an error.
edgarfgp Apr 23, 2025
55507e9
release notes
edgarfgp Apr 23, 2025
1738018
update tests
edgarfgp Apr 23, 2025
65f5bb6
Merge branch 'main' into fix-attr-targets
edgarfgp Apr 24, 2025
0c97b9d
Merge branch 'main' into fix-attr-targets
edgarfgp Apr 27, 2025
6f2b706
update baselines
edgarfgp Apr 29, 2025
e8f1bb0
Merge branch 'main' into fix-attr-targets
edgarfgp Apr 29, 2025
75d8f5e
Update baselines
edgarfgp Apr 29, 2025
4f2e97e
Merge branch 'fix-attr-targets' of github.com:edgarfgp/fsharp into fi…
edgarfgp Apr 29, 2025
63be5d5
Merge branch 'main' into fix-attr-targets
edgarfgp Apr 30, 2025
4248f2a
Move attribute form logic to an AP
edgarfgp Apr 30, 2025
cc96217
Merge branch 'main' into fix-attr-targets
edgarfgp May 1, 2025
e270b88
Merge branch 'main' into fix-attr-targets
edgarfgp May 1, 2025
e0cc65a
Merge branch 'main' into fix-attr-targets
edgarfgp May 2, 2025
1e29d58
Merge branch 'main' into fix-attr-targets
edgarfgp May 5, 2025
1470bf9
Merge branch 'main' into fix-attr-targets
edgarfgp May 6, 2025
8988215
Merge branch 'main' into fix-attr-targets
edgarfgp May 7, 2025
74712e8
Merge branch 'main' into fix-attr-targets
edgarfgp May 12, 2025
967c4a9
Merge branch 'main' of github.com:edgarfgp/fsharp
edgarfgp May 13, 2025
a30cef4
Merge branch 'dotnet:main' into main
edgarfgp May 22, 2025
5fa0480
Merge branch 'dotnet:main' into main
edgarfgp May 24, 2025
15e3d34
Merge branch 'dotnet:main' into main
edgarfgp May 29, 2025
b7ffcf8
Merge branch 'dotnet:main' into main
edgarfgp Jun 6, 2025
5bde641
Merge branch 'dotnet:main' into main
edgarfgp Jul 26, 2025
0f7c23c
Merge branch 'dotnet:main' into main
edgarfgp Jul 29, 2025
6a6843c
Merge branch 'dotnet:main' into main
edgarfgp Aug 4, 2025
d11dd4a
Merge branch 'dotnet:main' into main
edgarfgp Aug 4, 2025
30fc9a2
Merge branch 'dotnet:main' into main
edgarfgp Aug 5, 2025
835d645
Unify let, let!, use, use! LetOrUse AST representation.
edgarfgp Aug 5, 2025
6dcde2e
Fix computation expression pattern matching order
edgarfgp Aug 6, 2025
77aff92
Merge branch 'main' into unify-let-or-use-2
edgarfgp Aug 6, 2025
670aab8
format
edgarfgp Aug 7, 2025
a862ad1
release notes
edgarfgp Aug 7, 2025
cfb3d09
ILVerify
edgarfgp Aug 7, 2025
918f3e6
Fix computation expression pattern matching order
edgarfgp Aug 7, 2025
fcef811
update baselines
edgarfgp Aug 7, 2025
4d57d09
Fix SynPat shouldBeParenthesizedInContext
edgarfgp Aug 7, 2025
af8bf5a
Merge branch 'unify-let-or-use-2' of github.com:edgarfgp/fsharp into …
edgarfgp Aug 7, 2025
d3bac4a
Update SynPat.fs
edgarfgp Aug 7, 2025
0ceae7b
Attempt to fix editor test
edgarfgp Aug 8, 2025
2181367
Merge branch 'unify-let-or-use-2' of github.com:edgarfgp/fsharp into …
edgarfgp Aug 8, 2025
ca1c516
Simplify mkLetExpression
edgarfgp Aug 8, 2025
47429e6
one more test
edgarfgp Aug 8, 2025
a9f08ae
Add comments to explain the meaning of the new flags
edgarfgp Aug 8, 2025
121a373
Update to always use named fields
edgarfgp Aug 8, 2025
b1ed90b
document isFromSource
edgarfgp Aug 8, 2025
2f268f9
Rename isComputed to isBang
edgarfgp Aug 8, 2025
815c51b
Merge branch 'dotnet:main' into main
edgarfgp Aug 11, 2025
b57b244
Merge branch 'main' into unify-let-or-use-2
edgarfgp Aug 11, 2025
f6fa86e
update baselines
edgarfgp Aug 11, 2025
f1a2727
Release notes: add migration guidance
edgarfgp Aug 11, 2025
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
132 changes: 132 additions & 0 deletions docs/release-notes/.FSharp.Compiler.Service/10.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,135 @@
* Mark `Range.Zero` as obsolete in favor of `Range.range0` ([PR #18664](https://github.com/dotnet/fsharp/pull/18664))
* Use `Synbinding` to model `and!` ([PR #18805](https://github.com/dotnet/fsharp/pull/18805))
* Redesign #line processing. The original positions (unaffected by #line directives) are now kept in the AST, and `__LINE__` and `__SOURCE_LINE__` show the original line numbers / file names. However, all diagnostics and debug information stays the same (shows the position transformed by the #line directives). ([Issue #18553](https://github.com/dotnet/fsharp/issues/18553), [PR #18699](https://github.com/dotnet/fsharp/pull/18699))
* Unify `let`, `let!`, `use` and `use!` AST representation. ([PR #18825](https://github.com/dotnet/fsharp/pull/18825))[^1]

### Migration Guidance for AST Users

**Note:** The unified AST introduces two new boolean fields:
- `isFromSource`: Indicates if the binding comes from user-written code (`true`) or is compiler-generated (`false`)
- `isBang`: Distinguishes computation expression bindings (`let!`/`use!` = `true`) from regular bindings (`let`/`use` = `false`)

### 1. Pattern Matching Updates

**Before:**
```fsharp
match expr with
| SynExpr.LetOrUse(isRec, isUse, bindings, body, range, trivia) ->
// Handle regular let/use
| SynExpr.LetOrUseBang(spBind, isUse, isFromSource, pat, rhs, andBangs, body, range, trivia) ->
// Handle let!/use!
```

**After:**
```fsharp
match expr with
| SynExpr.LetOrUse(isRec, isUse, isFromSource, isBang, bindings, body, range, trivia) ->
if isBang then
// This is a let!/use! expression
match bindings with
| firstBinding :: andBangs ->
match firstBinding with
| SynBinding(headPat = pat; expr = rhs) ->
// pat and rhs extracted from first binding
// andBangs contains the and! bindings
| [] -> // error case
else
// This is a regular let/use expression
```

### 2. Construction Updates

**Before:**
```fsharp
// Creating a let! expression
SynExpr.LetOrUseBang(
bindDebugPoint,
false, // isUse
true, // isFromSource
pat,
rhsExpr,
andBangs,
bodyExpr,
range,
trivia
)
```

**After:**
```fsharp
// Creating a let! expression
let firstBinding = SynBinding(
accessibility = None,
kind = SynBindingKind.Normal,
isInline = false,
isMutable = false,
attributes = [],
xmlDoc = PreXmlDoc.Empty,
valData = SynInfo.emptySynValData,
headPat = pat, // Pattern moved here
returnInfo = None,
expr = rhsExpr, // RHS moved here
range = range,
debugPoint = bindDebugPoint, // Debug point moved here
trivia = bindingTrivia
)
SynExpr.LetOrUse(
false, // isRecursive
false, // isUse
true, // isFromSource
true, // isBang (indicates let!)
firstBinding :: andBangs, // All bindings in single list
bodyExpr,
range,
trivia
)
```

### 3. Common Migration Patterns

**Checking for computation expressions:**
```fsharp
// Before
match expr with
| SynExpr.LetOrUseBang _ -> true
| _ -> false

// After
match expr with
| SynExpr.LetOrUse(isBang = true) -> true
| _ -> false
```

**Extracting pattern and expression from let!:**
```fsharp
// Before
| SynExpr.LetOrUseBang(_, _, _, pat, rhs, _, _, _, _) ->
processBinding pat rhs

// After
| SynExpr.LetOrUse(isBang = true; bindings = binding :: _) ->
match binding with
| SynBinding(headPat = pat; expr = rhs) ->
processBinding pat rhs
| _ -> // error
```

**Processing and! bindings:**
```fsharp
// Before
| SynExpr.LetOrUseBang(_, _, _, firstPat, firstRhs, andBangs, _, _, _) ->
processFirst firstPat firstRhs
for andBang in andBangs do
processAndBang andBang

// After
| SynExpr.LetOrUse(isBang = true; bindings = bindings) ->
match bindings with
| first :: rest ->
processBinding first
for andBang in rest do
processAndBang andBang
| [] -> // error
```

[^1]: See [Migration Guidance for AST Users](#migration-guidance-for-ast-users) section for detailed information on how to update your code to work with the unified AST representation.
11 changes: 10 additions & 1 deletion src/Compiler/Checking/CheckRecordSyntaxHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,13 @@ let BindOriginalRecdExpr (withExpr: SynExpr * BlockSeparator) mkRecdExpr =
None,
SynBindingTrivia.Zero)

SynExpr.LetOrUse(false, false, [ binding ], mkRecdExpr (Some withExpr), mOrigExprSynth, SynExprLetOrUseTrivia.Zero)
SynExpr.LetOrUse(
isRecursive = false,
isUse = false,
isFromSource = false, // compiler generated during desugaring
isBang = false,
bindings = [ binding ],
body = mkRecdExpr (Some withExpr),
range = mOrigExprSynth,
trivia = SynExprLetOrUseTrivia.Zero
)
Loading
Loading