dotnet / dotnet/fsharp

Improve type formatting for C# nested types with generic parameters

Open
#13,202 0 comments 1 reaction 0 assignees View on GitHub
Area-LangService-ToolTips Bug Impact-Medium
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

**Is your feature request related to a problem? Please describe.**

`FSharpType.Format` for a C#-defined nested type is incorrect when the parent type contains a generic parameter.

The type annotation for `builder` in the following code:

```fsharp
open System.Collections.Immutable

let builder = ImmutableArray.CreateBuilder()
```

is ``val builder: ImmutableArray`1.Builder``, when it more accurately should be `ImmutableArray.Builder` to reflect the layout of the type declarations and the relationship between the parent and child.

**Describe the solution you'd like**

Generic parameters on parent types to be filled in at the point of declaration (`` `1 ``) instead of at the end of the child type.

**Describe alternatives you've considered**

Custom logic to detect this scenario and render the types manually.

**Additional context**

This is using FCS 41.0.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.