dotnet / dotnet/fsharp

Signature file generation does not handle WhereTyparSubtypeOfType

Open
#14,706 0 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-CodeGen Bug help wanted Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

When generating a signature file from a static member with a subtype constraint, the result is somewhat unexpected.

**Repro steps**

```fsharp
module Foo

type IProvider =
interface
end

type Tainted<'T> =
class
end

type ConstructB =
static member ComputeDefinitionLocationOfProvidedItem<'T when 'T :> IProvider>(p: Tainted<'T>) : obj option = None
```

leads to

```fsharp
module Foo

type IProvider =
interface end

type Tainted<'T> =
class end

type ConstructB =

static member ComputeDefinitionLocationOfProvidedItem: p: Tainted<#IProvider> -> obj option
```

**Expected behaviour**

`[]` should be added to `type ConstructB` (otherwise it won't compile) and overall I was expecting:

```fsharp
[]
type ConstructB =
static member ComputeDefinitionLocationOfProvidedItem<'T when 'T :> IProvider> : p: Tainted<'T> -> obj option
```

**Actual behaviour**

While the signature does compile, I do suspect it can lead to unexpected IL or influence the mvid in another way.

**Related information**

Detected via https://github.com/dotnet/fsharp/pull/14703

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.