summary refs log tree commit diff stats
path: root/tests/varres/tprevent_forloopvar_mutations.nim
blob: 39819165880fc9c37998c72510158e53ed95851d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
discard """
  errmsg: "type mismatch: got <int>"
  line: 17
  nimout: '''type mismatch: got <int>
but expected one of:
proc inc[T: Ordinal | uint | uint64](x: var T; y = 1)
  first type mismatch at position: 1
  required type for x: var T: Ordinal or uint or uint64
  but expression 'i' is immutable, not 'var'

expression: inc i
'''
"""

for i in 0..10:
  echo i
  inc i