fsharp
fsharp copied to clipboard
Transparent Compiler: Different diagnostics results
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:
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:
- Clone https://github.com/fsprojects/fantomas
- Restore + project cracking
- Use
FSharpCheckerwithTransparentCompiler=trueto request a check of all the projects in the solution in parallel and dump diagnostics - Use
FSharpCheckerwithTransparentCompiler=falseto 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)