I expect this will be detected at compile-time once we have the Z3 theorem prover: type DocKind = enum text, todo Doc = object case kind: DocKind of text: text: string of todo: todo: string let doc = Doc(kind: text, text: "some doc") echo doc.todo#compiles, throws exception Run
See [https://nim-lang.org/docs/drnim.html](https://nim-lang.org/docs/drnim.html) This is similar to eliding array bounds check and probably a low-hanging fruit to experiment with a prover integrated in a compiler.