Uh oh!
There was an error while loading. Please reload this page.
Remove LetOrUseKeyword from SynExprLetOrUseTrivia - #19090
Conversation
✅ No release notes required |
Uh oh!
There was an error while loading. Please reload this page.
nojaf
commented
Nov 14, 2025
Another issue I saw is the comp {let!a= b inand! c = d inand! e = f in()}I made some changes for that as well so that any |
nojaf
commented
Nov 14, 2025
Didn't take this into account yet but should the range of |
I'd say no. I see it as a part of a Even though it only makes sense in I'd put it to |
nojaf
commented
Nov 17, 2025
Yeah, makes sense but might be a bit tricky to implement. As LetOrUse now looks like: | LetOrUse of// isRecursive: true for 'let rec' and 'use rec' bindings, false for 'let' and 'use' bindings
isRecursive: bool */// isUse: true for 'use' and 'use!' bindings, false for 'let' and 'let!' isUse: bool *// isFromSource: flag indicates whether a binding was explicitly written by the user in the source code versus generated by the compiler during transformations.
isFromSource: bool *// isBang: true for 'let!' and 'use!' bindings, false for 'let' and 'use' bindings
isBang: bool *
bindings: SynBinding list *
body: SynExpr *
range: range(in my PR here) Having a list of optional A separate list is messy because it forces assuming both lists will have the same length. So it makes more sense to have a wrapper type that bundles SynBinding with the optional typeSynBindingAndMaybeAnInKeyword={
Binding:SynBinding;
InKeyword:Range option;}Once we're on that train of thought, it's not a stretch to put it in the SynBinding trivia like I currently do. It does not help that the code constructing these values is scattered across the parser. My take is that including it in SynBinding trivia is the most pragmatic approach. |
Why would it be a list? There can be at most one |
nojaf
commented
Nov 17, 2025
Example: comp {let!a= b
and! c = d inand! e = f in()}Becomes This used to be 1 After the refactor in F# 10 this information is now lost. |
auduchinok
commented
Nov 17, 2025
@nojaf Interesting, thanks! I suspect that allowing multiple The original RFC mentions the syntax that follows the rules of regular If that's a correct assumption, then the most sound way to proceed would be to disallow the extra @dsyme May we ask your opinion on the topic, please? |
T-Gro
commented
Nov 20, 2025
Do you foresee a way of disallowing that syntax with a reasonable recovery and an error message? (We have to assume that people don't read release notes and don't like their parsing of "yesterday it worked fine" code fail mid-file) If not easily doable, a staged approach (i.e. warning on this being a bug first, then remove 1 version later) would work for sure. |
auduchinok
commented
Nov 20, 2025
Yes, since it's already parsed properly we can just add an additional error reporting. |
nojaf
commented
Nov 22, 2025
Okay, this is now ready for review! Future PRs can address the |
auduchinok
left a comment
There was a problem hiding this comment.
@nojaf This is fantastic, thanks!
Uh oh!
There was an error while loading. Please reload this page.
nojaf
commented
Nov 30, 2025
Hi @T-Gro , I do not get the failures in |
T-Gro
commented
Dec 1, 2025
@nojaf : Maybe best to reproduce with a syntax tree test for some very basic |
nojaf
commented
Dec 2, 2025
@T-Gro thanks that did explain it. Green now |
Uh oh!
There was an error while loading. Please reload this page.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in dotnet/fsharp#19090. The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in: dotnet/fsharp#19090 The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in: dotnet/fsharp#19090 The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Most of the changes are down to the LetOrUse changes in: dotnet/fsharp#19090 The ExpressionUtilities.LetOrUse active pattern was taken from an implementation detail of that change as well as it avoids using when clauses in lots of places.
Description
As mentioned on #18825 (comment)
It would be most convenient if a
SynBindingholds all the information to print itself on its own.By extending
SynLeadingKeywordwe can do exactly that.Test cases added
Performance benchmarks added in case of performance changes
Release notes entry updated: