& another exploration: type FooType = enum ftA, ftB Foo[N: static[int]] = object typ: FooType # first guess: doesn't work! # # Test1[X: static[Foo]] = object # when X.typ == ftA: # Error: undeclared field: 'typ' for type Bar.X # prefix: string # other: int # view: array[X.N, int] # works?? Test2[X] = object when X.typ == ftA: prefix: string other: int view: array[X.N, int] # but then when actually trying to use it: const fooA = Foo[0](typ: ftA) var x: Test2[fooA] # SIGSEGV: Illegal storage access. (Attempt to read from nil?) Run
So I'm guessing that's a compiler bug -- tho the question remains what's _intended_ to work here.