mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
* 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
25 lines
392 B
Nim
25 lines
392 B
Nim
discard """
|
|
errormsg: "cannot mutate location x[0].a within a strict func"
|
|
line: 12
|
|
"""
|
|
|
|
{.experimental: "strictFuncs".}
|
|
|
|
func copy[T](x: var openArray[T]; y: openArray[T]) =
|
|
for i in 0..high(x):
|
|
x[i] = y[i]
|
|
|
|
x[0].a = nil
|
|
|
|
type
|
|
R = ref object
|
|
a, b: R
|
|
data: string
|
|
|
|
proc main =
|
|
var a, b: array[3, R]
|
|
b = [R(data: "a"), R(data: "b"), R(data: "c")]
|
|
copy a, b
|
|
|
|
main()
|