diff options
author | Zahary Karadjov <zahary@gmail.com> | 2018-04-23 17:23:14 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2018-06-16 16:46:32 +0300 |
commit | a49b06a52a3c24258e9eb04593a2f83ae057755f (patch) | |
tree | 17978b309659a7acc2a43fc349a40ed077e0a97b /tests/parser | |
parent | ab9969ed3be2d57fdeda170cc9960be7ba628149 (diff) | |
download | Nim-a49b06a52a3c24258e9eb04593a2f83ae057755f.tar.gz |
Implement the `is` operator for the new static and typedesc type classes
This also makes the first baby steps towards a sound treatment of higher-order kinds (type type int). Adds test cases showcasing the new features. * Also fixes breakage after the rebase
Diffstat (limited to 'tests/parser')
-rw-r--r-- | tests/parser/ttypeclasses.nim | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/tests/parser/ttypeclasses.nim b/tests/parser/ttypeclasses.nim index 9f487c7a8..46fd20686 100644 --- a/tests/parser/ttypeclasses.nim +++ b/tests/parser/ttypeclasses.nim @@ -1,17 +1,42 @@ -discard """ - action: run -""" - type R = ref V = var D = distinct P = ptr + T = type + S = static + OBJ = object + TPL = tuple + SEQ = seq +var i: int var x: ref int var y: distinct int var z: ptr int +const C = @[1, 2, 3] + +static: + assert x is ref + assert y is distinct + assert z is ptr + assert C is static + assert C[1] is static[int] + assert C[0] is static[SomeInteger] + assert C isnot static[string] + assert C is SEQ|OBJ + assert C isnot OBJ|TPL + assert int is int + assert int is T + assert int is SomeInteger + assert seq[int] is type + assert seq[int] is type[seq] + assert seq[int] isnot type[seq[float]] + assert i isnot type[int] + assert type(i) is type[int] + assert x isnot T + assert y isnot S + assert z isnot enum + assert x isnot object + assert y isnot tuple + assert z isnot seq -doAssert x is ref -doAssert y is distinct -doAssert z is ptr \ No newline at end of file |