summary refs log blame commit diff stats
path: root/tests/effects/tfuncs_cannot_mutate_simple.nim
blob: 9de20d1ec1a4e7bb8740b07fe323aa21bcdae52b (plain) (tree)




















                                                                
discard """
  errormsg: "'edit' can have side effects"
  nimout: '''an object reachable from 'x' is potentially mutated
tfuncs_cannot_mutate_simple.nim(17, 4) the mutation is here'''
  line: 16
"""

{.experimental: "strictFuncs".}

# bug #15508

type
  MyType = ref object
    data: string

func edit(x: MyType) =
  x.data = "hello"

let x = MyType()
x.edit()
echo x.data