diff options
Diffstat (limited to 'tests/compile/tisop.nim')
-rw-r--r-- | tests/compile/tisop.nim | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/tests/compile/tisop.nim b/tests/compile/tisop.nim deleted file mode 100644 index 509cc4e95..000000000 --- a/tests/compile/tisop.nim +++ /dev/null @@ -1,42 +0,0 @@ -import typetraits - -type - TRecord = (tuple) or (object) - - TFoo[T, U] = object - x: int - - when T is string: - y: float - else: - y: string - - when U is TRecord: - z: float - - E = enum A, B, C - -macro m(t: typedesc): typedesc = - if t is enum: - result = string - else: - result = int - -var f: TFoo[int, int] -static: assert(f.y.type.name == "string") - -when compiles(f.z): - {.error: "Foo should not have a `z` field".} - -proc p(a, b) = - when a.type is int: - static: assert false - - var f: TFoo[m(a.type), b.type] - static: - assert f.x.type.name == "int" - assert f.y.type.name == "float" - assert f.z.type.name == "float" - -p(A, f) - |