dotnet / dotnet/fsharp

Using multiple operators in INumber-constrained generic functions leads to compiler error

Open
#17,062 12 comments 2 reactions 0 assignees View on GitHub
Area-Compiler-Checking Area-Compiler-SRTP Bug Impact-Medium
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.

```fsharp
// ok
let numericOpsPlus<'T when INumber<'T>>(num: 'T) =
num + num

// FS0670 - code is not sufficiently generic
let numericOpsPlusPlus<'T when INumber<'T>>(num: 'T) =
num + num + num

// ok again
let inline numericOpsPlusPlusInlined<'T when INumber<'T>>(num: 'T) =
num + num + num
```

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.