diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-03-24 09:41:04 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-03-24 09:41:04 +0100 |
commit | 3be4f9111cadd84c77a0b619850092743b154a1e (patch) | |
tree | 3f18cbce6e0daca7c5e08ad0f2a22f1af8727a21 /tests/varres | |
parent | 6f747674be8eacc6d0fbd62b5dcfdb75c939bcc1 (diff) | |
download | Nim-3be4f9111cadd84c77a0b619850092743b154a1e.tar.gz |
enforce 'var T' produces a view into the first parameter; refs #7373
Diffstat (limited to 'tests/varres')
-rw-r--r-- | tests/varres/twrong_parameter.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/varres/twrong_parameter.nim b/tests/varres/twrong_parameter.nim new file mode 100644 index 000000000..34b0c7464 --- /dev/null +++ b/tests/varres/twrong_parameter.nim @@ -0,0 +1,12 @@ +discard """ + line: 6 + errormsg: "'x' is not the first parameter; context: 'x'" +""" + +proc forward(abc: int; x: var int): var int = result = x + +proc foo(): var int = + var y = 9 + result = forward(45, y) + +echo foo() |