Files
Nim/tests/effects/tfuncs_cannot_mutate_simple.nim
Andreas Rumpf 3812d91390 alternative, much simpler algorithm for strict func checking (#21066)
* alternative, much simpler algorithm for strict func checking

* forgot to git add new compiler module

* new spec is incredibly simple to describe

* fixes bigints regression

* typos

* closes #16305; closes #17387; closes #20863
2022-12-11 16:58:50 +01:00

20 lines
270 B
Nim

discard """
errormsg: '''cannot mutate location x.data within a strict func'''
line: 15
"""
{.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