dotnet / dotnet/fsharp

inline operator not working

Open
#18,561 0 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-Checking Area-Compiler-SRTP Bug
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**

Provide the steps required to reproduce the problem:

```
let inline (!?>)< 'a when 'a : (static member i : int) and 'a : comparison> () : int = 'a.i
let inline U< 'a when 'a : (static member i : int)> () : int = 'a.i

type Foo () =
static member i = 42

U()
(!?>) ()
```

**Expected behavior**

(!?>) () should get same result with U()

**Actual behavior**

However it give us
```
linqExpTest.fsx(61,2): error FS0001: The type '(unit -> int)' does not support the 'comparison' constraint. For example, it does not support the 'System.IComparable' interface
```
**Known workarounds**

None.

**Related information**

Provide any related information (optional):

* Operating system: Windows Server 2019
* .NET Runtime: .NET 9.0.103
* Editing Tools: Visual Studio 17

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.