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 23 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
4 changes: 3 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 Expand Up @@ -201,6 +202,7 @@ let methods =
// Print concatenated parameter lists
for mi in methods.Methods do
[ for p in mi.Parameters -> p.Display ]
|> List.collect (Array.map (fun tt -> tt.Text) >> Array.toList)
|> String.concat ", "
|> printfn "%s(%s)" methods.MethodName
(**
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
2 changes: 1 addition & 1 deletion docs/fcs/ja/compiler.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*)

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

let scs = FSharpChecker.Create()
Expand Down
3 changes: 2 additions & 1 deletion docs/fcs/ja/editor.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
#r "FSharp.Compiler.Service.dll"

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

// インタラクティブチェッカーのインスタンスを作成
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
7 changes: 4 additions & 3 deletions docs/fcs/ja/interactive.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ F# Interactiveの開始
*)

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

Expand Down Expand Up @@ -232,10 +233,10 @@ let parseResults, checkResults, checkProjectResults =

(**
`parseResults` と `checkResults` はそれぞれ [エディタ](editor.html)
のページで説明している `ParseFileResults` と `CheckFileResults` 型です。
のページで説明している `FSharpParseFileResults` と `FSharpCheckFileResults` 型です。
たとえば以下のようなコードでエラーを確認出来ます:
*)
checkResults.Errors.Length // 1
checkResults.Diagnostics.Length // 1

(**
コードはF# Interactiveセッション内において、その時点までに実行された
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
Loading