Skip to content

Commit 32f1792

Browse files
Merge main
2 parents 9e1d654 + b320870 commit 32f1792

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+121
-191
lines changed

docs/release-notes/.FSharp.Compiler.Service/10.0.100.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
* Parser: Capture named fields block separators. ([PR #18857](https://github.com/dotnet/fsharp/pull/18857))
4343
* Type checker: use inner expr range in upcast constraints errors ([PR #18850](https://github.com/dotnet/fsharp/pull/18850))
4444
* Import `IEnumerable` as `seq`. ([PR #18865](https://github.com/dotnet/fsharp/pull/18865))
45-
* Parser: Capture multiple block separators ([PR #18899](https://github.com/dotnet/fsharp/pull/18899))
4645

4746
### Breaking Changes
4847

eng/Version.Details.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ This file should be imported by eng/Versions.props
66
<Project>
77
<PropertyGroup>
88
<!-- dotnet/msbuild dependencies -->
9-
<MicrosoftBuildPackageVersion>18.0.0-preview-25472-05</MicrosoftBuildPackageVersion>
10-
<MicrosoftBuildFrameworkPackageVersion>18.0.0-preview-25472-05</MicrosoftBuildFrameworkPackageVersion>
11-
<MicrosoftBuildTasksCorePackageVersion>18.0.0-preview-25472-05</MicrosoftBuildTasksCorePackageVersion>
12-
<MicrosoftBuildUtilitiesCorePackageVersion>18.0.0-preview-25472-05</MicrosoftBuildUtilitiesCorePackageVersion>
9+
<MicrosoftBuildPackageVersion>18.0.0-preview-25476-03</MicrosoftBuildPackageVersion>
10+
<MicrosoftBuildFrameworkPackageVersion>18.0.0-preview-25476-03</MicrosoftBuildFrameworkPackageVersion>
11+
<MicrosoftBuildTasksCorePackageVersion>18.0.0-preview-25476-03</MicrosoftBuildTasksCorePackageVersion>
12+
<MicrosoftBuildUtilitiesCorePackageVersion>18.0.0-preview-25476-03</MicrosoftBuildUtilitiesCorePackageVersion>
1313
<!-- dotnet/runtime dependencies -->
1414
<SystemCollectionsImmutablePackageVersion>9.0.0</SystemCollectionsImmutablePackageVersion>
1515
<SystemComponentModelCompositionPackageVersion>9.0.0</SystemComponentModelCompositionPackageVersion>

eng/Version.Details.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
<Dependencies>
33
<Source Uri="https://github.com/dotnet/dotnet" Mapping="fsharp" Sha="2dea164f01d307c409cfe0d0ee5cb8a0691e3c94" BarId="283828" />
44
<ProductDependencies>
5-
<Dependency Name="Microsoft.Build" Version="18.0.0-preview-25472-05">
5+
<Dependency Name="Microsoft.Build" Version="18.0.0-preview-25476-03">
66
<Uri>https://github.com/dotnet/msbuild</Uri>
7-
<Sha>bf373edc7ed1110a03d28fde1e2cd258fce88a74</Sha>
7+
<Sha>5480b47bbc592c6feedca7c57c9863ba01e0c52c</Sha>
88
</Dependency>
9-
<Dependency Name="Microsoft.Build.Framework" Version="18.0.0-preview-25472-05">
9+
<Dependency Name="Microsoft.Build.Framework" Version="18.0.0-preview-25476-03">
1010
<Uri>https://github.com/dotnet/msbuild</Uri>
11-
<Sha>bf373edc7ed1110a03d28fde1e2cd258fce88a74</Sha>
11+
<Sha>5480b47bbc592c6feedca7c57c9863ba01e0c52c</Sha>
1212
</Dependency>
13-
<Dependency Name="Microsoft.Build.Tasks.Core" Version="18.0.0-preview-25472-05">
13+
<Dependency Name="Microsoft.Build.Tasks.Core" Version="18.0.0-preview-25476-03">
1414
<Uri>https://github.com/dotnet/msbuild</Uri>
15-
<Sha>bf373edc7ed1110a03d28fde1e2cd258fce88a74</Sha>
15+
<Sha>5480b47bbc592c6feedca7c57c9863ba01e0c52c</Sha>
1616
</Dependency>
17-
<Dependency Name="Microsoft.Build.Utilities.Core" Version="18.0.0-preview-25472-05">
17+
<Dependency Name="Microsoft.Build.Utilities.Core" Version="18.0.0-preview-25476-03">
1818
<Uri>https://github.com/dotnet/msbuild</Uri>
19-
<Sha>bf373edc7ed1110a03d28fde1e2cd258fce88a74</Sha>
19+
<Sha>5480b47bbc592c6feedca7c57c9863ba01e0c52c</Sha>
2020
</Dependency>
2121
<Dependency Name="System.Reflection.Metadata" Version="9.0.0">
2222
<Uri>https://github.com/dotnet/runtime</Uri>

src/Compiler/Checking/CheckDeclarations.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2697,7 +2697,7 @@ module EstablishTypeDefinitionCores =
26972697
spreadSrcTys.Add spreadSrcTy
26982698
ResolveRecordOrClassFieldsOfType cenv.nameResolver m ad spreadSrcTy false
26992699
|> List.choose (function
2700-
| Item.RecdField field -> Some (field.RecdField.Id.idText, (FreshenRecdFieldRef cenv.nameResolver m field.RecdFieldRef).FieldType, m)
2700+
| Item.RecdField field -> Some (field.RecdField.Id.idText, field.FieldType, m)
27012701
| _ -> None)
27022702
else
27032703
match tryDestAnonRecdTy g spreadSrcTy with

src/Compiler/Checking/CheckRecordSyntaxHelpers.fs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,19 @@ let TransformAstForNestedUpdates (cenv: TcFileState) (env: TcEnv) overallTy (lid
9191
let totalRange (origId: Ident) (id: Ident) =
9292
withStartEnd origId.idRange.End id.idRange.Start origId.idRange
9393

94-
match withExpr with
95-
| SynExpr.Ident origId, (blockSep: BlockSeparator) ->
96-
let lid, rng = upToId blockSep.Range id (origId :: ids)
94+
let rangeOfBlockSeparator (id: Ident) =
95+
let idEnd = id.idRange.End
96+
let blockSeparatorStartCol = idEnd.Column
97+
let blockSeparatorEndCol = blockSeparatorStartCol + 4
98+
let blockSeparatorStartPos = mkPos idEnd.Line blockSeparatorStartCol
99+
let blockSeparatorEndPos = mkPos idEnd.Line blockSeparatorEndCol
100+
101+
withStartEnd blockSeparatorStartPos blockSeparatorEndPos id.idRange
97102

98-
Some(
99-
SynExpr.LongIdent(false, LongIdentWithDots(lid, rng), None, totalRange origId id),
100-
BlockSeparator.Offside(blockSep.Range, None)
101-
)
103+
match withExpr with
104+
| SynExpr.Ident origId, (sepRange, _) ->
105+
let lid, rng = upToId sepRange id (origId :: ids)
106+
Some(SynExpr.LongIdent(false, LongIdentWithDots(lid, rng), None, totalRange origId id), (rangeOfBlockSeparator id, None))
102107
| _ -> None
103108

104109
let rec synExprRecd copyInfo (outerFieldId: Ident) innerFields exprBeingAssigned =

src/Compiler/Checking/CheckRecordSyntaxHelpers.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ val GroupUpdatesToNestedFields:
1212
fields: (ExplicitOrSpread<(Ident list * Ident) * SynExpr option, (Ident list * Ident) * 'Spread>) list ->
1313
(ExplicitOrSpread<(Ident list * Ident) * SynExpr option, (Ident list * Ident) * 'Spread>) list
1414

15-
val TransformAstForNestedUpdates:
15+
val TransformAstForNestedUpdates<'a> :
1616
cenv: TcFileState ->
1717
env: TcEnv ->
1818
overallTy: TType ->
1919
lid: LongIdent ->
2020
exprBeingAssigned: SynExpr ->
21-
withExpr: SynExpr * BlockSeparator ->
21+
withExpr: SynExpr * (range * 'a) ->
2222
(Ident list * Ident) * SynExpr option
2323

2424
val BindOriginalRecdExpr:

src/Compiler/Checking/Expressions/CheckExpressions.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7802,8 +7802,8 @@ and TcRecdExpr cenv overallTy env tpenv (inherits, withExprOpt, synRecdFields, m
78027802
let isFromNestedUpdate, fieldId, field =
78037803
match withExprOpt, synLongId.LongIdent, exprBeingAssigned with
78047804
| _, [ id ], _ -> false, id, ExplicitOrSpread.Explicit (([], id), exprBeingAssigned)
7805-
| Some (origExpr, blockSep), lid, Some exprBeingAssigned ->
7806-
let _, id as longIdent, exprBeingAssigned = TransformAstForNestedUpdates cenv env overallTy lid exprBeingAssigned (origExpr, blockSep)
7805+
| Some withExpr, lid, Some exprBeingAssigned ->
7806+
let _, id as longIdent, exprBeingAssigned = TransformAstForNestedUpdates cenv env overallTy lid exprBeingAssigned withExpr
78077807
true, id, ExplicitOrSpread.Explicit (longIdent, exprBeingAssigned)
78087808
| _ ->
78097809
let _, id as longIdent = List.frontAndBack synLongId.LongIdent

src/Compiler/Service/ServiceParseTreeWalk.fs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -445,12 +445,12 @@ module SyntaxTraversal =
445445
| SynExpr.AnonRecd(copyInfo = copyOpt; recordFields = fields) ->
446446
[
447447
match copyOpt with
448-
| Some(expr, blockSep) ->
448+
| Some(expr, (withRange, _)) ->
449449
yield dive expr expr.Range traverseSynExpr
450450

451451
yield
452-
dive () blockSep.Range (fun () ->
453-
if posGeq pos blockSep.Range.End then
452+
dive () withRange (fun () ->
453+
if posGeq pos withRange.End then
454454
// special case: caret is after WITH
455455
// { x with $ }
456456
visitor.VisitRecordField(path, Some expr, None)
@@ -503,24 +503,24 @@ module SyntaxTraversal =
503503
traverseSynExpr expr)
504504

505505
match sepOpt with
506-
| Some blockSep ->
506+
| Some(sep, scPosOpt) ->
507507
yield
508-
dive () blockSep.Range (fun () ->
508+
dive () sep (fun () ->
509509
// special case: caret is below 'inherit' + one or more fields are already defined
510510
// inherit A()
511511
// $
512512
// field1 = 5
513-
diveIntoSeparator inheritRange.StartColumn blockSep.Position None)
513+
diveIntoSeparator inheritRange.StartColumn scPosOpt None)
514514
| None -> ()
515515
| _ -> ()
516516

517517
match copyOpt with
518-
| Some(expr, blockSep) ->
518+
| Some(expr, (withRange, _)) ->
519519
yield dive expr expr.Range traverseSynExpr
520520

521521
yield
522-
dive () blockSep.Range (fun () ->
523-
if posGeq pos blockSep.Range.End then
522+
dive () withRange (fun () ->
523+
if posGeq pos withRange.End then
524524
// special case: caret is after WITH
525525
// { x with $ }
526526
visitor.VisitRecordField(path, Some expr, None)
@@ -563,30 +563,30 @@ module SyntaxTraversal =
563563
| None -> ()
564564

565565
match sepOpt with
566-
| Some blockSep ->
566+
| Some(sep, scPosOpt) ->
567567
yield
568-
dive () blockSep.Range (fun () ->
568+
dive () sep (fun () ->
569569
// special case: caret is between field bindings
570570
// field1 = 5
571571
// $
572572
// field2 = 5
573-
diveIntoSeparator offsideColumn blockSep.Position copyOpt)
573+
diveIntoSeparator offsideColumn scPosOpt copyOpt)
574574
| None -> ()
575575

576576
| SynExprRecordFieldOrSpread.Spread(SynExprSpread(spreadRange = spreadRange; expr = expr; without = _todo),
577577
sepOpt) ->
578578
yield dive expr expr.Range traverseSynExpr
579579

580580
match sepOpt with
581-
| Some blockSep ->
581+
| Some(sep, scPosOpt) ->
582582
yield
583-
dive () blockSep.Range (fun () ->
583+
dive () sep (fun () ->
584584
// special case: caret is between field bindings
585585
// field1 = 5
586586
// $
587587
// field2 = 5
588588
let offsideColumn = spreadRange.StartColumn
589-
diveIntoSeparator offsideColumn blockSep.Position copyOpt)
589+
diveIntoSeparator offsideColumn scPosOpt copyOpt)
590590
| None -> ()
591591
]
592592
|> pick expr

src/Compiler/SyntaxTree/SyntaxTree.fs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -306,23 +306,7 @@ type DebugPointAtBinding =
306306

307307
type SeqExprOnly = SeqExprOnly of bool
308308

309-
[<NoEquality; NoComparison; RequireQualifiedAccess>]
310-
type BlockSeparator =
311-
| Semicolon of range: range * position: pos option
312-
| Comma of range: range * position: pos option
313-
| Offside of range: range * position: pos option
314-
315-
member this.Range =
316-
match this with
317-
| Semicolon(range = m)
318-
| Comma(range = m)
319-
| Offside(range = m) -> m
320-
321-
member this.Position =
322-
match this with
323-
| Semicolon(position = p)
324-
| Comma(position = p)
325-
| Offside(position = p) -> p
309+
type BlockSeparator = range * pos option
326310

327311
type RecordFieldName = SynLongIdent * bool
328312

src/Compiler/SyntaxTree/SyntaxTree.fsi

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -354,26 +354,9 @@ type SeqExprOnly =
354354
/// Indicates if a for loop is 'for x in e1 -> e2', only valid in sequence expressions
355355
| SeqExprOnly of bool
356356

357-
/// Represents the location of the separator block and optional position of the semicolon (used for tooling support)
358-
[<NoEquality; NoComparison; RequireQualifiedAccess>]
359-
type BlockSeparator =
360-
/// A separator consisting of a semicolon ';'
361-
/// range is the range of the semicolon
362-
/// position is the position of the semicolon (if available)
363-
| Semicolon of range: range * position: pos option
364-
/// A separator consisting of a comma ','
365-
/// range is the range of the comma
366-
/// position is the position of the comma (if available)
367-
| Comma of range: range * position: pos option
368-
369-
// A separator consisting of a newline
370-
/// range is the range of the newline
371-
/// position is the position of the newline (if available)
372-
| Offside of range: range * position: pos option
373-
374-
member Range: range
375-
376-
member Position: pos option
357+
/// Represents the location of the separator block + optional position
358+
/// of the semicolon (used for tooling support)
359+
type BlockSeparator = range * pos option
377360

378361
/// Represents a record field name plus a flag indicating if given record field name is syntactically
379362
/// correct and can be used in name resolution.

0 commit comments

Comments
 (0)