Skip to content

Commit

Permalink
Update FCS to 'Add parser recovery for incomplete named pat pair' (#2823
Browse files Browse the repository at this point in the history
)
  • Loading branch information
nojaf committed Apr 3, 2023
1 parent e0212d2 commit 9298c26
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [Unreleased]

### Changed
* Update FCS to 'Add parser recovery for incomplete named pat pair', commit ba6647ebf5b94823c4d6fafd1e7d5f806d915ee0

## [6.0.0-alpha-010] - 2023-04-03

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Some common use cases include:

<!-- Versions -->
<PropertyGroup>
<FCSCommitHash>62dfce601573f44779b9c890e8944826f5ccfef0</FCSCommitHash>
<FCSCommitHash>ba6647ebf5b94823c4d6fafd1e7d5f806d915ee0</FCSCommitHash>
<StreamJsonRpcVersion>2.8.28</StreamJsonRpcVersion>
<FSharpCoreVersion>6.0.1</FSharpCoreVersion>
</PropertyGroup>
Expand Down
28 changes: 15 additions & 13 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -984,11 +984,9 @@ let mkExpr (creationAide: CreationAide) (e: SynExpr) : Expr =
let fields =
recordFields
|> List.choose (function
| ident, Some mEq, e ->
let m = unionRanges ident.idRange e.Range

let longIdent =
IdentListNode([ IdentifierOrDot.Ident(mkIdent ident) ], ident.idRange)
| sli, Some mEq, e ->
let m = unionRanges sli.Range e.Range
let longIdent = mkSynLongIdent sli

Some(RecordFieldNode(longIdent, stn "=" mEq, mkExpr creationAide e, m))
| _ -> None)
Expand All @@ -1006,12 +1004,9 @@ let mkExpr (creationAide: CreationAide) (e: SynExpr) : Expr =
let fields =
recordFields
|> List.choose (function
| ident, Some mEq, e ->
let m = unionRanges ident.idRange e.Range

let longIdent =
IdentListNode([ IdentifierOrDot.Ident(mkIdent ident) ], ident.idRange)

| sli, Some mEq, e ->
let m = unionRanges sli.Range e.Range
let longIdent = mkSynLongIdent sli
Some(RecordFieldNode(longIdent, stn "=" mEq, mkExpr creationAide e, m))
| _ -> None)

Expand Down Expand Up @@ -1628,8 +1623,15 @@ let mkPat (creationAide: CreationAide) (p: SynPat) =

let pairs =
nps
|> List.map (fun (ident, eq, pat) ->
NamePatPair(mkIdent ident, stn "=" eq, mkPat creationAide pat, unionRanges ident.idRange pat.Range))
|> List.choose (fun (ident, eq, pat) ->
eq
|> Option.map (fun eq ->
NamePatPair(
mkIdent ident,
stn "=" eq,
mkPat creationAide pat,
unionRanges ident.idRange pat.Range
)))

PatNamePatPairsNode(mkSynLongIdent synLongIdent, typarDecls, stn "(" lpr, pairs, stn ")" rpr, patternRange)
|> Pattern.NamePatPairs
Expand Down

0 comments on commit 9298c26

Please sign in to comment.