summary refs log blame commit diff stats
path: root/tests/varres/tprevent_forloopvar_mutations.nim
blob: 96bb208c2386c58c6dc49f32f58d1593fc244803 (plain) (tree)
1
2
3
4
5
6
7
8
           
                                      
                                                                                     
                    
                                     
                                    
                                     
                                            







                 
discard """
  errormsg: "type mismatch: got <int>"
  nimout: '''tprevent_forloopvar_mutations.nim(16, 7) Error: type mismatch: got <int>
but expected one of:
proc inc[T: Ordinal](x: var T; y = 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