tfuncs_cannot_mutate_simple.nim 270 B

1234567891011121314151617181920
  1. discard """
  2. errormsg: '''cannot mutate location x.data within a strict func'''
  3. line: 15
  4. """
  5. {.experimental: "strictFuncs".}
  6. # bug #15508
  7. type
  8. MyType = ref object
  9. data: string
  10. func edit(x: MyType) =
  11. x.data = "hello"
  12. let x = MyType()
  13. x.edit()
  14. echo x.data