diff options
Diffstat (limited to 'tests/varres/tprevent_forloopvar_mutations.nim')
-rw-r--r-- | tests/varres/tprevent_forloopvar_mutations.nim | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/varres/tprevent_forloopvar_mutations.nim b/tests/varres/tprevent_forloopvar_mutations.nim new file mode 100644 index 000000000..c9aeb94d8 --- /dev/null +++ b/tests/varres/tprevent_forloopvar_mutations.nim @@ -0,0 +1,16 @@ +discard """ + errormsg: "type mismatch: got <int>" + nimout: '''tprevent_forloopvar_mutations.nim(16, 3) Error: type mismatch: got <int> +but expected one of: +proc inc[T, V: Ordinal](x: var T; y: V = 1) + first type mismatch at position: 1 + required type for x: var T: Ordinal + but expression 'i' is immutable, not 'var' + +expression: inc i +''' +""" + +for i in 0..10: + echo i + inc i |