diff options
Diffstat (limited to 'tests/reject/tconstr1.nim')
-rw-r--r-- | tests/reject/tconstr1.nim | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/reject/tconstr1.nim b/tests/reject/tconstr1.nim new file mode 100644 index 000000000..488170350 --- /dev/null +++ b/tests/reject/tconstr1.nim @@ -0,0 +1,23 @@ +# Test array, record constructors + +type + TComplexRecord = tuple[ + s: string, + x, y: int, + z: float, + chars: set[Char]] + +proc testSem = + var + things: array [0..1, TComplexRecord] = [ + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a', 'b', 'c'})] + write(stdout, things[0].x) + +const + things: array [0..1, TComplexRecord] = [ + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0)] #ERROR + otherThings = [ # the same + (s: "hi", x: 69, y: 45, z: 0.0, chars: {'a', 'b', 'c'}), + (s: "hi", x: 69, y: 45, z: 1.0, chars: {'a'})] |