Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyme committed Jul 11, 2022
2 parents 56372c2 + 0c1eba0 commit 3138bbb
Show file tree
Hide file tree
Showing 503 changed files with 46,134 additions and 35,645 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fantomas": {
"version": "5.0.0-alpha-008",
"version": "5.0.0-alpha-011",
"commands": [
"fantomas"
]
Expand Down
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,17 @@ fsharp_max_if_then_else_short_width=40
# fsharp_max_function_binding_width formats these over a single line.
[src/Compiler/Driver/CompilerDiagnostics.fs]
fsharp_max_function_binding_width=70

# This file contains long specifications of navigation items
[src/Compiler/Service/ServiceStructure.fs]
fsharp_max_value_binding_width=100

# This file contains long specifications of navigation items
[src/Compiler/Service/ServiceNavigation.fs]
max_line_length=170
fsharp_max_value_binding_width=120

# This file contains long calls with explicitly named arguments
[src/Compiler/Service/service.fs]
max_line_length=150
fsharp_max_value_binding_width=100
13 changes: 8 additions & 5 deletions .fantomasignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ docs/
eng/
fcs-samples/
scripts/
service/
setup/
tests/
vsintegration/
Expand All @@ -14,17 +13,17 @@ artifacts/
# Explicitly unformatted implementation files

src/Compiler/Checking/**/*.fs
src/Compiler/CodeGen/**/*.fs
src/Compiler/DependencyManager/**/*.fs
src/Compiler/Facilities/**/*.fs
src/Compiler/Interactive/**/*.fs
src/Compiler/Legacy/**/*.fs
src/Compiler/Optimize/**/*.fs
src/Compiler/Service/**/*.fs
src/Compiler/Symbols/**/*.fs
src/Compiler/SyntaxTree/**/*.fs
src/Compiler/TypedTree/**/*.fs
src/Microsoft.FSharp.Compiler/**/*.fs

# Explicitly unformatted file that needs more care to get it to format well

src/Compiler/SyntaxTree/LexFilter.fs

# Fantomas limitations on implementation files in FSharp.Core (to investigate)

Expand All @@ -47,6 +46,10 @@ src/FSharp.Core/SI.fs

src/Compiler/AbstractIL/ilwrite.fs
src/Compiler/Utilities/lib.fs
src/Compiler/Service/IncrementalBuild.fs
src/Compiler/Service/ServiceAssemblyContent.fs
src/Compiler/Service/ServiceDeclarationLists.fs
src/Compiler/Service/ServiceErrorResolutionHints.fs

# Fantomas limitations on signature files (to investigate)

Expand Down
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ ossreadme*.txt
*.fsproj.user
*.vbproj.user
*.sln.DotSettings.user
launchSettings.json
*.log
*.jrs
*.chk
*.bak
*.bak
*.vserr
*.err
*.orig
Expand Down Expand Up @@ -118,4 +119,7 @@ nCrunchTemp_*

.fake
*.pdb
*.dll
*.dll

/test.fs
/test.fsx
38 changes: 30 additions & 8 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ If your changes involve modifying the list of language keywords in any way, (e.g
```shell
dotnet build src\Compiler /t:UpdateXlf
```
If you are on a Mac, you can run this command from the root of the repository:

This only works on Windows/.NETStandard framework, so changing this from any other platform requires editing and syncing all of the XLF files manually.
```shell
sh build.sh -c Release
```

## Updating baselines in tests

Expand All @@ -139,16 +142,35 @@ are updated using scripts or utilities that allow the following environment vari

Windows:

CMD:

```shell
set TEST_UPDATE_BSL=1
```

PowerShell:

```shell
$env:TEST_UPDATE_BSL=1
```

Linux/macOS:

```shell
export TEST_UPDATE_BSL=1
```

Next, run a build script build (debug or release, desktop or coreclr, depending which baselines you need to update), and test as described [above](#Testing-from-the-command-line). For example:

`./Build.cmd -c Release -testCoreClr` to update Release CoreCLR baselines.

or

`./Build.cmd -c Release -testDesktop` to update Release .NET Framework baselines.

> **Note**
> Please note, that by default, **Release** version of IL baseline baseline tests will be running in CI, so when updating baseline files, make sure to add `-c Release` flag to the build command.
## Automated Source Code Formatting

Some of the code in this repository is formatted automatically by [Fantomas](https://github.com/fsprojects/fantomas). To format all files use:
Expand Down Expand Up @@ -215,11 +237,11 @@ Where `<version>` corresponds to the latest Visual Studio version on your machin

* Format using [the F# style guide](https://docs.microsoft.com/en-us/dotnet/fsharp/style-guide/)

* Avoid tick identifiers like `body'`. They are generally harder to read and can't be inspected in the debugger as things stand. Generaly use R suffix instead, e.g. `bodyR`. The R can stand for "rewritten" or "result"
* Avoid tick identifiers like `body'`. They are generally harder to read and can't be inspected in the debugger as things stand. Generally use R suffix instead, e.g. `bodyR`. The R can stand for "rewritten" or "result"

* Avoid abbreviations like `bodyty` that run together lowercase are bad, really hard to head for newcomers. Use `bodyTy` instead.
* Avoid abbreviations like `bodyty` that are all lowercase. They are really hard to read for newcomers. Use `bodyTy` instead.

* See the comiler docs for common abbreviations
* See the compiler docs for common abbreviations

* Don't use `List.iter` and `Array.iter` in the compiler, a `for ... do ...` loop is simpler to read and debug

Expand All @@ -242,10 +264,10 @@ Existing compiler benchmarks can be found in `tests\benchmarks\`.

1. Perform a clean build of the compiler and FCS from source (as described in this document, build can be done with `-noVisualStudio` in case if FCS/FSharp.Core is being benchmarked/profiled).

2. Create a benchmark project (in this example, the project will be created in `tests\benchmarks\`).
2. Create a benchmark project (in this example, the project will be created in `tests\benchmarks\FCSBenchmarks`).

```shell
cd tests\benchmarks
cd tests\benchmarks\FCSBenchmarks
dotnet new console -o FcsBench --name FcsBench -lang F#
```

Expand All @@ -257,7 +279,7 @@ Existing compiler benchmarks can be found in `tests\benchmarks\`.
dotnet add reference ..\..\..\src\Compiler\FSharp.Compiler.Service.fsproj
```

4. Additionally, if you want to test changes to the FSharp.Core
4. Additionally, if you want to test changes to the FSharp.Core (note that the relative path can be different)

```shell
dotnet add reference ..\..\..\src\FSharp.Core\FSharp.Core.fsproj
Expand Down Expand Up @@ -349,7 +371,7 @@ Existing compiler benchmarks can be found in `tests\benchmarks\`.
```shell
> ls .\BenchmarkDotNet.Artifacts\results\
Directory: C:\Users\vlza\code\fsharp\tests\benchmarks\FcsBench\BenchmarkDotNet.Artifacts\results
Directory: C:\Users\vlza\code\fsharp\tests\benchmarks\FCSBenchmarks\FcsBench\BenchmarkDotNet.Artifacts\results
Mode LastWriteTime Length Name
---- ------------- ------ ----
Expand Down
5 changes: 5 additions & 0 deletions FSharp.Compiler.Service.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.ComponentTe
{38A23D53-E2BF-4B76-907F-49F41D60C88E} = {38A23D53-E2BF-4B76-907F-49F41D60C88E}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DD4D4A7E-D519-4409-89DA-16DCA3EF80AA}"
ProjectSection(SolutionItems) = preProject
src\Compiler\FSComp.txt = src\Compiler\FSComp.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
Loading

0 comments on commit 3138bbb

Please sign in to comment.