Warning or error should be raised when alternative constructor calls itself
Open
Area-Diagnostics
Feature Improvement
Theme-Simple-F#
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
The language spec (8.6.3) says that any additional constructor should call _another_ constructor.
It's possible for an additional constructor to call itself (presumably accidentally on the part of the programmer), which results in a stack overflow.
#### Repro steps
```
type MyClass(a, b) =
new(a) = MyClass(a)
let x = MyClass(1)
```
#### Expected behavior
Compiler should issue a warning or error when a constructor calls itself.
#### Actual behavior
StackOverflowException is thrown.
#### Known workarounds
N/A
#### Related information
Windows 7, F#4.0, .NET 4.5.2
Severity = low
Contributor guide
Assessment
This issue has not been assessed yet.