dotnet / dotnet/fsharp

Base type constraint incorrectly flagged as incompatiable in recursive type definitions

Open
#7,843 1 comment 0 reactions 0 assignees View on GitHub
Area-Compiler-Checking Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

**Repro steps**
F# Interactive version 10.6.0.0 for F# 4.7
```fs
type A<'T>() = class end
type B<'T, 'A when 'A :> A<'T>>() = class end
type C() = inherit A()
and [>)>] C' = class end // error
type [>)>] D() = class end // ok
```
**Expected behavior**
Compiles fine.

**Actual behavior**
![image](https://user-images.githubusercontent.com/19922066/68687424-1dc02e00-05a8-11ea-9832-c80a8a716b86.png)
Note `D` has no errors.

**Known workarounds**
```diff
-and [>)>] C' = class end // error
+and [>>)>] C' = class end // no error
```
**Related information**

Provide any related information (optional):

* Operating system: Windows 10
* .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET Framework
* Editing Tools (e.g. Visual Studio Version, Visual Studio): VS16.3.8

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.