dotnet / dotnet/fsharp

Using `TailCall` diagnostic attribute on non tailcall rec function does not generate warning on Visual Studio Error List pane

Open
#16,467 11 comments 0 reactions 0 assignees View on GitHub
Analyzers
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

Please provide a succinct description of the issue.

**Repro steps**

Steps required to reproduce the problem:

1. Use this code on any .fs file and compile it:

```
[]
let rec private sumListTailRecHelperWithTailcallDiagnostic accumulator xs =
match xs with
| [] -> accumulator
| y::ys -> sumListTailRecHelper (accumulator+y) ys

/// This example computes the sum of a list of integers using recursion.
[]
let rec sumList xs =
match xs with
| [] -> 0
| y::ys -> y + sumList ys
```
2. Watch the output pane for Build and the Error List pane.

Is this intentional? As usually compiler warning is also always shown on Error List pane.

**Expected behavior**

Both Error List pane and the Output pane of Build should show the warning of using TailCall attribute on non tailcall rec function.

**Actual behavior**

Only Built output show compiler warning, whereas the Error List do not show the warning:

![image](https://github.com/dotnet/fsharp/assets/8773147/544ab042-fb56-4df7-87e1-bc95e746b2d0)

**Known workarounds**

As far as I know, none. I have tried to clear the compiler output folder, and compile again using clean rebuild.

**Related information**

Provide any related information (optional):

* Operating system: Windows 11 23H2
* .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET 8.0
* Editing Tools (e.g. Visual Studio Version, Visual Studio): VS 2022 v17.8.1 (also reproducible on 17.8.3)

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.