Skip to content

Commit

Permalink
Update FCS to 'Correct range of SynInterfaceImpl' (#2919)
Browse files Browse the repository at this point in the history
* Update FCS to 'Correct range of SynInterfaceImpl'

* Remove unused files

* Restore FSStrings.resx

* Update test input

* Add changelog entry
  • Loading branch information
nojaf authored Jun 29, 2023
1 parent f912c0b commit 21bda5b
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 94 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 6.1.1 - 2023-06-29

### Changed
* Update FCS to 'Remove unused open in SyntaxTree.fs', commit 9c8b4192966e6554adc5dcc8973f2a23c8fa2722

## 6.1.0 - 2023-06-28

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

<!-- Versions -->
<PropertyGroup>
<FCSCommitHash>5b74995780a0e9d24a5db025e68b31e6d910f71f</FCSCommitHash>
<FCSCommitHash>9c8b4192966e6554adc5dcc8973f2a23c8fa2722</FCSCommitHash>
<StreamJsonRpcVersion>2.8.28</StreamJsonRpcVersion>
<FSharpCoreVersion>6.0.1</FSharpCoreVersion>
</PropertyGroup>
Expand Down
11 changes: 0 additions & 11 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ pipeline "Init" {
stage "Download FCS files" {
run (fun _ ->
[| "src/Compiler/FSComp.txt"
"src/Compiler/Interactive/FSIstrings.txt"
"src/Compiler/FSStrings.resx"
"src/Compiler/Utilities/Activity.fsi"
"src/Compiler/Utilities/Activity.fs"
Expand Down Expand Up @@ -261,24 +260,16 @@ pipeline "Init" {
"src/Compiler/Utilities/XmlAdapters.fs"
"src/Compiler/Utilities/InternalCollections.fsi"
"src/Compiler/Utilities/InternalCollections.fs"
"src/Compiler/Utilities/QueueList.fsi"
"src/Compiler/Utilities/QueueList.fs"
"src/Compiler/Utilities/lib.fsi"
"src/Compiler/Utilities/lib.fs"
"src/Compiler/Utilities/rational.fsi"
"src/Compiler/Utilities/rational.fs"
"src/Compiler/Utilities/PathMap.fsi"
"src/Compiler/Utilities/PathMap.fs"
"src/Compiler/Utilities/RidHelpers.fs"
"src/Compiler/Utilities/range.fsi"
"src/Compiler/Utilities/range.fs"
"src/Compiler/Facilities/UtilsStrings.txt"
"src/Compiler/Facilities/LanguageFeatures.fsi"
"src/Compiler/Facilities/LanguageFeatures.fs"
"src/Compiler/Facilities/DiagnosticOptions.fsi"
"src/Compiler/Facilities/DiagnosticOptions.fs"
"src/Compiler/Facilities/TextLayoutRender.fsi"
"src/Compiler/Facilities/TextLayoutRender.fs"
"src/Compiler/Facilities/DiagnosticsLogger.fsi"
"src/Compiler/Facilities/DiagnosticsLogger.fs"
"src/Compiler/Facilities/prim-lexing.fsi"
Expand All @@ -289,8 +280,6 @@ pipeline "Init" {
"src/Compiler/AbstractIL/ilpars.fsy"
"src/Compiler/AbstractIL/il.fsi"
"src/Compiler/AbstractIL/il.fs"
"src/Compiler/AbstractIL/ilx.fsi"
"src/Compiler/AbstractIL/ilx.fs"
"src/Compiler/AbstractIL/ilascii.fsi"
"src/Compiler/AbstractIL/ilascii.fs"
"src/Compiler/SyntaxTree/PrettyNaming.fsi"
Expand Down
6 changes: 3 additions & 3 deletions src/Fantomas.Core.Tests/AlignedMultilineBracketStyleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1445,9 +1445,9 @@ let z = {|
let a = {| // test1
foo with
Level = 7
Square = 9
// test2
Level = 7
Square = 9
// test2
|}
"""
config
Expand Down
8 changes: 4 additions & 4 deletions src/Fantomas.Core.Tests/CastTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ module Foo =
let foo =
{ new IDisposable with
member __.Dispose () =
do ()
do ()
upcast ()
upcast ()
}
"""
{ config with
Expand Down Expand Up @@ -179,9 +179,9 @@ module Foo =
let foo =
{ new IDisposable with
member __.Dispose () =
do ()
do ()
downcast ()
downcast ()
}
"""
{ config with
Expand Down
17 changes: 9 additions & 8 deletions src/Fantomas.Core.Tests/CommentTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -589,17 +589,18 @@ printfn "hello world"
let ``preserve block comment after record, 516`` () =
formatSourceString
false
"""module TriviaModule =
"""
module TriviaModule =

let env = "DEBUG"
let env = "DEBUG"

type Config = {
Name: string
Level: int
}
type Config = {
Name: string
Level: int
}

let meh = { // this comment right
Name = "FOO"; Level = 78 }
let meh = { // this comment right
Name = "FOO"; Level = 78 }

(* ending with block comment *)
"""
Expand Down
18 changes: 9 additions & 9 deletions src/Fantomas.Core.Tests/CrampedMultilineBracketStyleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2247,9 +2247,9 @@ let z = {|

let a = {| // test1
foo with
Level = 7
Square = 9
// test2
Level = 7
Square = 9
// test2
|}
"""
config
Expand Down Expand Up @@ -2355,12 +2355,12 @@ let ``multiline field body expression where indent_size = 2, update record`` ()
let handlerFormattedRangeDoc (lines: NamedText, formatted: string, range: FormatSelectionRange) =
let range =
{ x with
Start =
{ Line = range.StartLine - 1
Character = range.StartColumn }
End =
{ Line = range.EndLine - 1
Character = range.EndColumn } }
Start =
{ Line = range.StartLine - 1
Character = range.StartColumn }
End =
{ Line = range.EndLine - 1
Character = range.EndColumn } }

[| { Range = range; NewText = formatted } |]
"""
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/OperatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,7 +1355,7 @@ let ``add space around binary operators in units of measure, 2207`` () =
type Test =
{ WorkHoursPerWeek: uint<hr*(staff weeks)> }
static member create =
{ WorkHoursPerWeek = 40u<hr*(staff weeks)> }
{ WorkHoursPerWeek = 40u<hr*(staff weeks)> }
"""
{ config with
NewlineBetweenTypeDefinitionAndMembers = false }
Expand Down
11 changes: 6 additions & 5 deletions src/Fantomas.Core.Tests/Stroustrup/ExperimentalElmishTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,12 @@ let view =
let ``div with multiple attributes and children`` () =
formatSourceString
false
"""let d =
div [ ClassName "container"; OnClick (fun _ -> printfn "meh") ] [
span [] [str "foo"]
code [] [str "bar"]
]
"""
let d =
div [ ClassName "container"; OnClick (fun _ -> printfn "meh") ] [
span [] [str "foo"]
code [] [str "bar"]
]
"""
{ config with MaxArrayOrListWidth = 40 }
|> prepend newline
Expand Down
35 changes: 20 additions & 15 deletions src/Fantomas.Core.Tests/TypeDeclarationTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1605,10 +1605,11 @@ type SomeType() =
let ``split multiple parameters over multiple lines`` () =
formatSourceString
false
"""type SomeType =
"""
type SomeType =
static member SomeMember (looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1: string) (looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong2: string) : string =
printfn "a"
"b"
printfn "a"
"b"
"""
config
|> prepend newline
Expand All @@ -1628,10 +1629,11 @@ type SomeType =
let ``split multiple parameters over multiple lines and have correct indentation afterwards`` () =
formatSourceString
false
"""type SomeType =
"""
type SomeType =
static member SomeMember (looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1: string) (looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong2: string) : string =
printfn "a"
"b"
printfn "a"
"b"
static member SomeOtherMember () = printfn "c"
"""
Expand All @@ -1656,10 +1658,11 @@ type SomeType =
let ``member with one long parameter and return type, 850`` () =
formatSourceString
false
"""type SomeType =
"""
type SomeType =
static member SomeMember loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1 : string =
printfn "a"
"b"
printfn "a"
"b"
"""
config
|> prepend newline
Expand All @@ -1678,10 +1681,11 @@ type SomeType =
let ``member with one long parameter and no return type, 850`` () =
formatSourceString
false
"""type SomeType =
"""
type SomeType =
static member SomeMember loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1 =
printfn "a"
"b"
printfn "a"
"b"
"""
config
|> prepend newline
Expand All @@ -1700,10 +1704,11 @@ type SomeType =
let ``multiple members with one long parameter`` () =
formatSourceString
false
"""type SomeType =
"""
type SomeType =
static member SomeMember loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong1 =
printfn "a"
"b"
printfn "a"
"b"
static member Serialize (loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong2: SomeType) = Encode.string v.Meh
static member Deserialize (loooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnngggggggggggJsonVaaaaalueeeeeeeeeeeeeeee) : SomeType = Decode.SomeType loooooooooooooooooooooooooooooooooooooooooooooooooooooonnnnnnnnnnnnnnnnnnnnngggggggggggJsonVaaaaalueeeeeeeeeeeeeeee
Expand Down
6 changes: 1 addition & 5 deletions src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,11 +1022,6 @@ let mkExpr (creationAide: CreationAide) (e: SynExpr) : Expr =
let interfaceNodes =
ims
|> List.map (fun (SynInterfaceImpl(t, mWith, bs, members, StartRange 9 (mInterface, m))) ->
let m =
match List.tryLast members with
| None -> m
| Some ms -> mkRange m.FileName m.Start ms.Range.End

InterfaceImplNode(
stn "interface" mInterface,
mkType creationAide t,
Expand Down Expand Up @@ -2222,6 +2217,7 @@ let mkSynLeadingKeyword (lk: SynLeadingKeyword) =
| SynLeadingKeyword.Abstract abstractRange -> mtn [ "abstract", abstractRange ]
| SynLeadingKeyword.AbstractMember(abstractRange, memberRange) ->
mtn [ "abstract", abstractRange; "member", memberRange ]
| SynLeadingKeyword.Static staticRange -> mtn [ "static", staticRange ]
| SynLeadingKeyword.StaticMember(staticRange, memberRange) -> mtn [ "static", staticRange; "member", memberRange ]
| SynLeadingKeyword.StaticMemberVal(staticRange, memberRange, valRange) ->
mtn [ "static", staticRange; "member", memberRange; "val", valRange ]
Expand Down
31 changes: 0 additions & 31 deletions src/Fantomas.FCS/Fantomas.FCS.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
<EmbeddedText Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\FSComp.txt">
<Link>FSComp.txt</Link>
</EmbeddedText>
<EmbeddedText Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Interactive\FSIstrings.txt">
<Link>FSIstrings.txt</Link>
</EmbeddedText>
<EmbeddedResource Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\FSStrings.resx">
<Link>FSStrings.resx</Link>
<LogicalName>FSStrings.resources</LogicalName>
Expand Down Expand Up @@ -103,40 +100,24 @@
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\InternalCollections.fs">
<Link>Utilities\InternalCollections.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\QueueList.fsi">
<Link>Utilities\QueueList.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\QueueList.fs">
<Link>Utilities\QueueList.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\lib.fsi">
<Link>Utilities\lib.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\lib.fs">
<Link>Utilities\lib.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\rational.fsi">
<Link>Utilities\rational.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\rational.fs">
<Link>Utilities\rational.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\PathMap.fsi">
<Link>Utilities\PathMap.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\PathMap.fs">
<Link>Utilities\PathMap.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\RidHelpers.fs">
<Link>Utilities\RidHelpers.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\range.fsi">
<Link>Utilities\range.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\range.fs">
<Link>Utilities\range.fs</Link>
</Compile>
<EmbeddedText Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\UtilsStrings.txt" />
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\LanguageFeatures.fsi">
<Link>Facilities\LanguageFeatures.fsi</Link>
</Compile>
Expand All @@ -149,12 +130,6 @@
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\DiagnosticOptions.fs">
<Link>Facilities\DiagnosticOptions.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\TextLayoutRender.fsi">
<Link>Facilities\TextLayoutRender.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\TextLayoutRender.fs">
<Link>Facilities\TextLayoutRender.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\DiagnosticsLogger.fsi">
<Link>Facilities\DiagnosticsLogger.fsi</Link>
</Compile>
Expand Down Expand Up @@ -193,12 +168,6 @@
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\AbstractIL\il.fs">
<Link>AbstractIL\il.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\AbstractIL\ilx.fsi">
<Link>AbstractIL\ilx.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\AbstractIL\ilx.fs">
<Link>AbstractIL\ilx.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\AbstractIL\ilascii.fsi">
<Link>AbstractIL\ilascii.fsi</Link>
</Compile>
Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.FCS/Parse.fs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ let createLexerFunction (defines: string list) lexbuf (errorLogger: CapturingDia
let compilingFsLib = false

let tokenizer =
LexFilter.LexFilter(lightStatus, compilingFsLib, Lexer.token lexargs true, lexbuf)
LexFilter.LexFilter(lightStatus, compilingFsLib, Lexer.token lexargs true, lexbuf, false)

(fun _ -> tokenizer.GetToken())

Expand Down

0 comments on commit 21bda5b

Please sign in to comment.