Nim
Nim copied to clipboard
[Concepts] Recursive concepts cause a compiler segfault when testing with `is`
trafficstars
Example
type
A = concept
proc test(x: Self, y: A)
proc test(x: int, y: int) = discard
discard (int is A)
Current Output
The compiler crashes.
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Expected Output
An error message or successful compilation.
Possible Solution
- Disallow referring to the concept being defined inside its definition.
Additional Information
$ nim -v Nim Compiler Version 1.5.1 [Linux: amd64] Compiled at 2021-04-02 Copyright (c) 2006-2021 by Andreas Rumpf
git hash: 9abd383a2ae36e50ee23b78654e9d8154db46c84 active boot switches: -d:release