summary refs log tree commit diff stats
path: root/tests/effects/tfuncs_cannot_mutate_simple.nim
blob: a94a8d74677091c33fb265069850f1975848a5a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
discard """
  errormsg: "'edit' can have side effects"
  nimout: '''an object reachable from 'x' is potentially mutated
tfuncs_cannot_mutate_simple.nim(16, 4) the mutation is here'''
"""

{.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