Skip to content

Commit 886205d

Browse files
author
Don Syme
committed
Merge branch 'main' of https://github.com/dotnet/fsharp into feature/fcsw
2 parents f619ca0 + 07e12af commit 886205d

File tree

81 files changed

+937
-941
lines changed

Some content is hidden

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

81 files changed

+937
-941
lines changed

docs/compiler-guide.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ There are several artifacts involved in the development of F#:
1818

1919
The `FSharp.Compiler.Private` is by far the largest of these components and contains nearly all logic that `fsc` and `fsi` use. It is the primary subject of this guide.
2020

21-
The F# compiler repositories are used to produce a range of different artifacts. For the purposes of this
22-
guide, the important ones are:
21+
## Resources for learning
22+
23+
* Video: [Learn me some F# Compiler, an online chat with Vlad and Don](https://www.youtube.com/watch?v=-dKf15xSWPY)
24+
25+
* Video: [Understanding the F# Optimizer, and online chat with Vlad and Don](https://www.youtube.com/watch?v=sfAe5lDue7k)
2326

2427
## Key data formats and representations
2528

@@ -110,8 +113,10 @@ These and transformations used to build the following:
110113
## Tools to help work with the compiler
111114

112115
* [sharplab.io](https://sharplab.io/) can be used to decompile code.
116+
113117
* [fantomas-tools](https://fsprojects.github.io/fantomas-tools/#/ast) can be used to view the Untyped & Typed Abstract Syntax Tree.
114118

119+
115120
## Coding standards and idioms
116121

117122
The compiler codebase uses various abbreviations. Here are some of the most common ones.

docs/fcs/caches.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../artifacts/bin/fcs/net461"
2+
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
Compiler Services: Notes on the FSharpChecker caches
55
=================================================

docs/fcs/compiler.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../artifacts/bin/fcs/net461"
2+
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
Hosted Compiler
55
===============

docs/fcs/corelib.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../artifacts/bin/fcs/net461"
2+
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
Compiler Services: Notes on FSharp.Core.dll
55
=================================================

docs/fcs/editor.fsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../artifacts/bin/fcs/net461"
2+
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
Compiler Services: Editor services
55
==================================
@@ -166,8 +166,7 @@ where we need to perform the completion.
166166
// Get declarations (autocomplete) for a location
167167
let decls =
168168
checkFileResults.GetDeclarationListInfo
169-
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun () -> []), fun _ -> false)
170-
|> Async.RunSynchronously
169+
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun () -> []))
171170

172171
// Print the names of available items
173172
for item in decls.Items do
@@ -199,7 +198,6 @@ changes):
199198
// Get overloads of the String.Concat method
200199
let methods =
201200
checkFileResults.GetMethods(5, 27, inputLines.[4], Some ["String"; "Concat"])
202-
|> Async.RunSynchronously
203201

204202
// Print concatenated parameter lists
205203
for mi in methods.Methods do

docs/fcs/filesystem.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../artifacts/bin/fcs/net461"
2+
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
Compiler Services: Virtualized File System
55
==========================================

docs/fcs/interactive.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../artifacts/bin/fcs/net461"
2+
#I "../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
Interactive Service: Embedding F# Interactive
55
=============================================

docs/fcs/ja/compiler.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../../artifacts/bin/fcs/net461"
2+
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
コンパイラの組み込み
55
====================

docs/fcs/ja/corelib.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../../artifacts/bin/fcs/net461"
2+
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
コンパイラサービス: FSharp.Core.dll についてのメモ
55
==================================================

docs/fcs/ja/editor.fsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#I "../../../../artifacts/bin/fcs/net461"
2+
#I "../../../artifacts/bin/FSharp.Compiler.Service/Debug/netstandard2.0"
33
(**
44
コンパイラサービス: エディタサービス
55
====================================
@@ -29,6 +29,7 @@
2929

3030
open System
3131
open FSharp.Compiler.SourceCodeServices
32+
open FSharp.Compiler.Text
3233

3334
// インタラクティブチェッカーのインスタンスを作成
3435
let checker = FSharpChecker.Create()
@@ -56,7 +57,7 @@ printfn "%s" msg.
5657
let inputLines = input.Split('\n')
5758
let file = "/home/user/Test.fsx"
5859

59-
let projOptions, _errors1 = checker.GetProjectOptionsFromScript(file, input) |> Async.RunSynchronously
60+
let projOptions, _errors1 = checker.GetProjectOptionsFromScript(file, SourceText.ofString input) |> Async.RunSynchronously
6061

6162
let parsingOptions, _errors2 = checker.GetParsingOptionsFromProjectOptions(projOptions)
6263

@@ -73,7 +74,7 @@ let parsingOptions, _errors2 = checker.GetParsingOptionsFromProjectOptions(projO
7374
*)
7475
// パースを実行
7576
let parseFileResults =
76-
checker.ParseFile(file, input, parsingOptions)
77+
checker.ParseFile(file, SourceText.ofString input, parsingOptions)
7778
|> Async.RunSynchronously
7879
(**
7980
`TypeCheckResults` に備えられた興味深い機能の紹介に入る前に、
@@ -84,15 +85,15 @@ F#コードにエラーがあった場合も何らかの型チェックの結果
8485

8586
// 型チェックを実行
8687
let checkFileAnswer =
87-
checker.CheckFileInProject(parseFileResults, file, 0, input, projOptions)
88+
checker.CheckFileInProject(parseFileResults, file, 0, SourceText.ofString input, projOptions)
8889
|> Async.RunSynchronously
8990

9091
(**
9192
あるいは `ParseAndCheckFileInProject` を使用すれば1つの操作で両方のチェックを行うことができます:
9293
*)
9394

9495
let parseResults2, checkFileAnswer2 =
95-
checker.ParseAndCheckFileInProject(file, 0, input, projOptions)
96+
checker.ParseAndCheckFileInProject(file, 0, SourceText.ofString input, projOptions)
9697
|> Async.RunSynchronously
9798

9899
(**
@@ -178,8 +179,7 @@ printfn "%A" tip
178179
// 特定の位置における宣言(自動補完)を取得する
179180
let decls =
180181
checkFileResults.GetDeclarationListInfo
181-
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun _ -> []), fun _ -> false)
182-
|> Async.RunSynchronously
182+
(Some parseFileResults, 7, inputLines.[6], PartialLongName.Empty 23, (fun _ -> []))
183183

184184
// 利用可能な項目を表示
185185
for item in decls.Items do
@@ -213,7 +213,7 @@ for item in decls.Items do
213213
*)
214214
//String.Concatメソッドのオーバーロードを取得する
215215
let methods =
216-
checkFileResults.GetMethods(5, 27, inputLines.[4], Some ["String"; "Concat"]) |> Async.RunSynchronously
216+
checkFileResults.GetMethods(5, 27, inputLines.[4], Some ["String"; "Concat"])
217217

218218
// 連結された引数リストを表示
219219
for mi in methods.Methods do

0 commit comments

Comments
 (0)