dotnet / dotnet/fsharp

Transparent Compiler: Different diagnostics results

Open
#16,729 0 comments 1 reaction 1 assignee Claimed by @0101 View on GitHub
Bug Impact-Low Transparent-Compiler
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Using the Transparent Compiler in FCS produces different diagnostics for the Fantomas solution.

**Repro steps**

Run the below script that checks out and runs the `fsharp_scripts` tool:
```powershell
git clone https://github.com/safesparrow/fsharp_scripts
cd fsharp_scripts
git checkout 1af31008beb27a1ab29a7e881b1aa5c1627cfc62
cd Scripts.Sample
dotnet run
```
The program involves the following steps:
1. Clone https://github.com/fsprojects/fantomas
2. Restore + project cracking
3. Use `FSharpChecker` with `TransparentCompiler=true` to request a check of all the projects in the solution in parallel and dump diagnostics
4. Use `FSharpChecker` with `TransparentCompiler=false` to request a check of all the projects in the solution in parallel and dump diagnostics

**Expected behavior**

Diagnostics are identical in both runs.

**Actual behavior**

First check, using `TransparentCompiler=true`, produces the following diagnostic:
```
[12:22:52 INF] : Diagnostic | Fantomas.FCS.fsproj | ..\..\.deps\e2496896c128ccfde33c92f45bbe0d2aa738873a\src\Compiler\lex.fsl | This expression was expected to have type ''a -> string' but here has type 'string'
```

Second check, using `TransparentCompiler=false`, produces a different diagnostic:
```
[12:23:09 INF] : Diagnostic | Fantomas.Tests.fsproj | C:\projekty\fsharp\test_f\fsharp_scripts\.cache\fsprojects__fantomas\de8ac507\_\src\Fantomas.Tests\IgnoreFileTests.fs | The value 'current'' is not accessible from this code location
```

**Known workarounds**

Do not use TransparentCompiler

**Related information**

Provide any related information (optional):

* FCS version `43.8.300-preview.24115.2`, published on 2024-02-16 (latest available on NuGet)
* Windows 11
* Samples project run using SDK 8.0.101
* Editing Tools (e.g. Visual Studio Version, Visual Studio)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.