mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
21 lines
361 B
Nim
21 lines
361 B
Nim
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
|