Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCS namespace revamp #10971

Merged
merged 27 commits into from
Feb 4, 2021
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f1b54c5
start of FCS namespace changes
Jan 28, 2021
ade30f4
more work on API namespaces
Jan 28, 2021
430f522
further work on namespaces and visitors
Jan 29, 2021
c4287e8
further work on namespaces and visitors
Jan 29, 2021
375902e
further work on namespaces and visitors
Jan 29, 2021
738dca7
integrate main and fix build
Jan 29, 2021
067ca19
integrate main and fix build
Jan 29, 2021
68e23d5
integrate main and fix build
Jan 29, 2021
26c2a6f
fix docs
Jan 29, 2021
cc411db
integrate main and fix build
Jan 29, 2021
f403acc
update baseline
Jan 29, 2021
d20d8d4
Merge branch 'main' of https://github.com/dotnet/fsharp into fcs6
Feb 1, 2021
348cb46
restore code lost in transition
Feb 1, 2021
8d4d6ec
cleanup naming in SyntaxTree and move more things to EditorServices
Feb 2, 2021
bd733b6
remove use of ImmutableArray from FSI signature
Feb 2, 2021
00fcc5b
cleanup XML doc in Symbol API and FSharp* naming in EditorServices
Feb 2, 2021
0f82fef
remove unused ExtraProjectInfo from FSharpProjectOptions
Feb 2, 2021
2f86b85
FSharp.COmpiler.TextLayout --> FSharp.Compiler.Text; update baseline;…
Feb 2, 2021
91bb446
update baseline
Feb 2, 2021
c2bd140
merge main
Feb 3, 2021
79211de
fix test
Feb 3, 2021
4731937
update release notes
Feb 3, 2021
2e38943
add SyntaxTree.fsi
Feb 3, 2021
4313b07
fix baseline
Feb 3, 2021
0a54eb0
merge ErrorResolutionHints into CompilerDiagnostics
Feb 3, 2021
be63dc9
merge ErrorResolutionHints into CompilerDiagnostics
Feb 3, 2021
cb8740b
remove comments from SyntaxTree.fs in favour of SyntaxTree.fsi
Feb 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions docs/compiler-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,14 +564,14 @@ The "intended" FCS API is the parts under the namespaces
* FSharp.Compiler.SourceCodeServices.* (analysis, compilation, tooling, lexing)
* FSharp.Compiler.Interactive.Shell.* (scripting support)
* FSharp.Compiler.AbstractIL.* (for ILAssemblyReader hook for Rider)
* FSharp.Compiler.SyntaxTree.* (direct access to full untyped tree)
* FSharp.Compiler.Syntax.* (direct access to full untyped tree)

These sections are generally designed with F#/.NET design conventions (e.g. types in namespaces, not modules, no nesting of modules etc.)
and we will continue to iterate to make this so.

In contrast, the public parts of the compiler directly under `FSharp.Compiler.*` and `FSharp.AbstractIL.*` are
"incidental" and not really designed for public use apart from the hook for Jet Brains Rider
(Aside: In theory all these other parts could be renamed to FSharp.Compiler.Internal though there's no need to do that right now).
"incidental" and not really designed for public use apart from the hook for JetBrains Rider
(Aside: In theory all these other parts could be renamed to FSharp.Compiler though there's no need to do that right now).
These internal parts tend to be implemented with the "module containing lots of stuff in one big file" approach for layers of the compiler.


Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/compiler.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ First, we need to reference the libraries that contain F# interactive service:

#r "FSharp.Compiler.Service.dll"
open System.IO
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text

// Create an interactive checker instance
Expand Down
3 changes: 2 additions & 1 deletion docs/fcs/editor.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ of `InteractiveChecker`:
#r "FSharp.Compiler.Service.dll"

open System
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.EditorServices
open FSharp.Compiler.Text

// Create an interactive checker instance
Expand Down
5 changes: 3 additions & 2 deletions docs/fcs/filesystem.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ open System
open System.IO
open System.Collections.Generic
open System.Text
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.IO
open FSharp.Compiler.Text

let defaultFileSystem = FileSystem
Expand Down Expand Up @@ -154,7 +155,7 @@ let projectOptions =

let results = checker.ParseAndCheckProject(projectOptions) |> Async.RunSynchronously

results.Errors
results.Diagnostics
results.AssemblySignature.Entities.Count //2
results.AssemblySignature.Entities.[0].MembersFunctionsAndValues.Count //1
results.AssemblySignature.Entities.[0].MembersFunctionsAndValues.[0].DisplayName // "B"
Expand Down
5 changes: 2 additions & 3 deletions docs/fcs/interactive.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ First, we need to reference the libraries that contain F# interactive service:

#r "FSharp.Compiler.Service.dll"
open FSharp.Compiler.Interactive.Shell
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.Text
open FSharp.Compiler.EditorServices

(**
To communicate with F# interactive, we need to create streams that represent input and
Expand Down Expand Up @@ -220,7 +219,7 @@ let parseResults, checkResults, checkProjectResults =
The `parseResults` and `checkResults` have types `ParseFileResults` and `CheckFileResults`
explained in [Editor](editor.html). You can, for example, look at the type errors in the code:
*)
checkResults.Errors.Length // 1
checkResults.Diagnostics.Length // 1

(**
The code is checked with respect to the logical type context available in the F# interactive session
Expand Down
7 changes: 4 additions & 3 deletions docs/fcs/ja/filesystem.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ FileSystemの設定
#r "FSharp.Compiler.Service.dll"
open System.IO
open System.Text
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.IO
open FSharp.Compiler.Text

let defaultFileSystem = FileSystem
Expand Down Expand Up @@ -98,7 +99,7 @@ FileSystemによるコンパイルの実行
--------------------------------

*)
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis

let checker = FSharpChecker.Create()
let projectOptions =
Expand Down Expand Up @@ -136,7 +137,7 @@ let projectOptions =

let results = checker.ParseAndCheckProject(projectOptions) |> Async.RunSynchronously

results.Errors
results.Diagnostics
results.AssemblySignature.Entities.Count //2
results.AssemblySignature.Entities.[0].MembersFunctionsAndValues.Count //1
results.AssemblySignature.Entities.[0].MembersFunctionsAndValues.[0].DisplayName // "B"
Expand Down
14 changes: 7 additions & 7 deletions docs/fcs/ja/project.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

open System
open System.Collections.Generic
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text

// インタラクティブチェッカーのインスタンスを作成
Expand Down Expand Up @@ -110,13 +110,13 @@ let wholeProjectResults = checker.ParseAndCheckProject(projectOptions) |> Async.
(**
発生したエラーと警告は以下のようにしてチェックできます:
*)
wholeProjectResults.Errors.Length // 1
wholeProjectResults.Errors.[0].Message.Contains("Incomplete pattern matches on this expression") // true
wholeProjectResults.Diagnostics.Length // 1
wholeProjectResults.Diagnostics.[0].Message.Contains("Incomplete pattern matches on this expression") // true

wholeProjectResults.Errors.[0].StartLineAlternate // 13
wholeProjectResults.Errors.[0].EndLineAlternate // 13
wholeProjectResults.Errors.[0].StartColumn // 15
wholeProjectResults.Errors.[0].EndColumn // 16
wholeProjectResults.Diagnostics.[0].StartLineAlternate // 13
wholeProjectResults.Diagnostics.[0].EndLineAlternate // 13
wholeProjectResults.Diagnostics.[0].StartColumn // 15
wholeProjectResults.Diagnostics.[0].EndColumn // 16

(**
推測されたプロジェクトのシグネチャをチェックします:
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/ja/symbols.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

open System
open System.IO
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text

// インタラクティブチェッカーのインスタンスを作成
Expand Down
3 changes: 2 additions & 1 deletion docs/fcs/ja/tokenizer.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ F#のソースコードに対して、トークナイザは
`SourceCodeServices` 名前空間をオープンします:
*)
#r "FSharp.Compiler.Service.dll"
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.EditorServices
open FSharp.Compiler.Text
(**
すると `FSharpSourceTokenizer` のインスタンスを作成できるようになります。
Expand Down
4 changes: 2 additions & 2 deletions docs/fcs/ja/untypedtree.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*)
#r "FSharp.Compiler.Service.dll"
open System
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text
(**

Expand Down Expand Up @@ -102,7 +102,7 @@ ASTを理解するには

ASTに関連する要素は以下の名前空間に含まれています:
*)
open FSharp.Compiler.SyntaxTree
open FSharp.Compiler.Syntax
(**

ASTを処理する場合、異なる文法的要素に対するパターンマッチを行うような
Expand Down
14 changes: 7 additions & 7 deletions docs/fcs/project.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ of `InteractiveChecker`:

open System
open System.Collections.Generic
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text

// Create an interactive checker instance
Expand Down Expand Up @@ -128,13 +128,13 @@ let wholeProjectResults = checker.ParseAndCheckProject(projectOptions) |> Async.
(**
Now look at the errors and warnings:
*)
wholeProjectResults .Errors.Length // 1
wholeProjectResults.Errors.[0].Message.Contains("Incomplete pattern matches on this expression") // yes it does
wholeProjectResults.Diagnostics.Length // 1
wholeProjectResults.Diagnostics.[0].Message.Contains("Incomplete pattern matches on this expression") // yes it does

wholeProjectResults.Errors.[0].StartLineAlternate // 13
wholeProjectResults.Errors.[0].EndLineAlternate // 13
wholeProjectResults.Errors.[0].StartColumn // 15
wholeProjectResults.Errors.[0].EndColumn // 16
wholeProjectResults.Diagnostics.[0].StartLineAlternate // 13
wholeProjectResults.Diagnostics.[0].EndLineAlternate // 13
wholeProjectResults.Diagnostics.[0].StartColumn // 15
wholeProjectResults.Diagnostics.[0].EndColumn // 16

(**
Now look at the inferred signature for the project:
Expand Down
2 changes: 1 addition & 1 deletion docs/fcs/symbols.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ of `FSharpChecker`:

open System
open System.IO
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text

// Create an interactive checker instance
Expand Down
3 changes: 2 additions & 1 deletion docs/fcs/tokenizer.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ To use the tokenizer, reference `FSharp.Compiler.Service.dll` and open the
`SourceCodeServices` namespace:
*)
#r "FSharp.Compiler.Service.dll"
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.EditorServices
open FSharp.Compiler.Text
(**
Now you can create an instance of `FSharpSourceTokenizer`. The class takes two
Expand Down
6 changes: 3 additions & 3 deletions docs/fcs/typedtree.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ To use the interactive checker, reference `FSharp.Compiler.Service.dll` and open
#r "FSharp.Compiler.Service.dll"
open System
open System.IO
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.EditorServices
open FSharp.Compiler.Text
(**

Expand Down Expand Up @@ -75,8 +76,7 @@ type MyClass() =
let checkProjectResults =
parseAndCheckSingleFile(input2)

checkProjectResults.Errors // should be empty

checkProjectResults.Diagnostics // should be empty

(**

Expand Down
4 changes: 2 additions & 2 deletions docs/fcs/untypedtree.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To use the interactive checker, reference `FSharp.Compiler.Service.dll` and open
*)
#r "FSharp.Compiler.Service.dll"
open System
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.CodeAnalysis
open FSharp.Compiler.Text
(**

Expand Down Expand Up @@ -84,7 +84,7 @@ code](https://github.com/fsharp/fsharp/blob/master/src/fsharp/ast.fs#L464).

The relevant parts are in the following namespace:
*)
open FSharp.Compiler.SyntaxTree
open FSharp.Compiler.Syntax
(**

When processing the AST, you will typically write a number of mutually recursive functions
Expand Down
4 changes: 2 additions & 2 deletions fcs-samples/FscExe/FscMain.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ open System.IO
open System.Reflection
open System.Runtime.CompilerServices
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.AbstractIL.Internal.Utils // runningOnMono
open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler.AbstractIL.Utils // runningOnMono
open FSharp.Compiler.AbstractIL.Library
open FSharp.Compiler.ErrorLogger

#if RESIDENT_COMPILER
Expand Down
2 changes: 1 addition & 1 deletion fcs-samples/UntypedTree/Program.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Open the namespace with InteractiveChecker type
open FSharp.Compiler.SourceCodeServices
open FSharp.Compiler.SyntaxTree
open FSharp.Compiler.Syntax

// Create a checker instance (ignore notifications)
let checker = FSharpChecker.Create()
Expand Down
28 changes: 17 additions & 11 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ This is a big update to FCS. There are significant trimmings and renamings of th
Renamings:

```diff
-type FSharp.Compiler.AbstractIL.Internal.Library.IFileSystem
+type FSharp.Compiler.SourceCodeServices.IFileSystem
-type FSharp.Compiler.AbstractIL.Library.IFileSystem
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only correct if we plan on getting this in for FCS 39, which to my knowledge isn't the case? At least not that I'm aware of

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind - just let me know the schedule.

(TBH I'm ok with delaying 39 until this is in, even if it's not 100% complete it's still better to get the foundational renames into the ecosystem. But I don't know if there are people desperate to get 39 or not)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to, at a minimum, release FCS 39 with VS 16.9. VS 16.9 bits are locked down for bug fixes only. So I highly doubt we'd incorporate this right now since it's helpful from a coherency standpoint - until we have a shipping cadence for FCS properly established - to have bits map to one another cleanly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FCS 39 would come with a bunch of bug fixes and improvements already, so folks definitely would want it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, eagerly anticipating a drop of 39 (since the nightlies aren't usable for packaging reasons :) ).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK great thank you. So I think that means we can integrate this to master and not into 16.9 release branch? I'll make sure the release notes are separate under 40.0

+type FSharp.Compiler.IO.IFileSystem

-module FSharp.Compiler.AbstractIL.Internal.Library.Shim
+FSharp.Compiler.SourceCodeServices.FileSystemAutoOpens
-module FSharp.Compiler.AbstractIL.Library.Shim
+FSharp.Compiler.IO.FileSystemAutoOpens

-type FSharp.Compiler.AbstractIL.Internal.Layout
-type FSharp.Compiler.AbstractIL.Layout
+type FSharp.Compiler.TextLayout.Layout

-type FSharp.Compiler.AbstractIL.Internal.TaggedText
-type FSharp.Compiler.AbstractIL.TaggedText
+type FSharp.Compiler.TextLayout.TaggedText

-type FSharp.Compiler.Layout.layout
Expand Down Expand Up @@ -94,19 +94,19 @@ Renamings:
+module FSharp.Compiler.Text.Range

-module FSharp.Compiler.QuickParse
+module FSharp.Compiler.SourceCodeServices.QuickParse
+module FSharp.Compiler.EditorServices.QuickParse

-module FSharp.Compiler.PrettyNaming
+FSharp.Compiler.SourceCodeServices.PrettyNaming
+FSharp.Compiler.Syntax.PrettyNaming

-val FSharpKeywords.PrettyNaming.KeywordNames
+FSharp.Compiler.SourceCodeServices.FSharpKeywords.KeywordNames
+FSharp.Compiler.Syntax.FSharpKeywords.KeywordNames

-val FSharpKeywords.PrettyNaming.QuoteIdentifierIfNeeded
+FSharp.Compiler.SourceCodeServices.FSharpKeywords.QuoteIdentifierIfNeeded
+FSharp.Compiler.Syntax.FSharpKeywords.QuoteIdentifierIfNeeded

-val FSharpKeywords.PrettyNaming.FormatAndOtherOverloadsString
+FSharp.Compiler.SourceCodeServices.FSharpKeywords.FormatAndOtherOverloadsString
+FSharp.Compiler.Syntax.FSharpKeywords.FormatAndOtherOverloadsString
```

Renamings in `FSharp.Compiler.SourceCodeServices`:
Expand Down Expand Up @@ -138,6 +138,12 @@ Renamings in `FSharp.Compiler.SourceCodeServices`:

-module Tooltips
+module FSharpTooltip

-FSharpParseFileResults.Errors
+FSharpParseFileResults.Diagnostics

-FSharpCheckFileResults.Errors
+FSharpCheckFileResults.Diagnostics
```

* Extension methods in `ServiceAssemblyContent.fsi` are now now intrinsic methods on the symbol types themselves.
Expand Down
3 changes: 1 addition & 2 deletions src/fsharp/AttributeChecking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ module internal FSharp.Compiler.AttributeChecking

open System
open System.Collections.Generic
open Internal.Utilities.Library
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.Internal.Library

open FSharp.Compiler
open FSharp.Compiler.ErrorLogger
open FSharp.Compiler.Infos
Expand Down
1 change: 1 addition & 0 deletions src/fsharp/AttributeChecking.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ open FSharp.Compiler.Text
open FSharp.Compiler.TypedTree

exception ObsoleteWarning of string * range

exception ObsoleteError of string * range

type AttribInfo =
Expand Down
5 changes: 2 additions & 3 deletions src/fsharp/AugmentWithHashCompare.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
/// Generate the hash/compare functions we add to user-defined types by default.
module internal FSharp.Compiler.AugmentWithHashCompare

open Internal.Utilities.Library
open FSharp.Compiler.AbstractIL
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.Internal.Library
open FSharp.Compiler.ErrorLogger
open FSharp.Compiler.Infos
open FSharp.Compiler.SyntaxTree
open FSharp.Compiler.Syntax
open FSharp.Compiler.TcGlobals
open FSharp.Compiler.TypedTree
open FSharp.Compiler.TypedTreeBasics
open FSharp.Compiler.TypedTreeOps
open FSharp.Compiler.XmlDoc

let mkIComparableCompareToSlotSig (g: TcGlobals) =
TSlotSig("CompareTo", g.mk_IComparable_ty, [], [], [[TSlotParam(Some("obj"), g.obj_ty, false, false, false, [])]], Some g.int_ty)
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/BinaryResourceFormats.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

module internal FSharp.Compiler.BinaryResourceFormats

open Internal.Utilities
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.Internal

// Helpers for generating binary blobs
module BinaryGenerationUtilities =
Expand Down
Loading