diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-09-06 22:01:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-06 22:01:39 +0200 |
commit | 2f6d04fd5d302646d40abc60b611653ec58463d0 (patch) | |
tree | 85a81c8958e7d166e7d1dd9cb70e6615cabc6bd0 /tests | |
parent | 072c6556539706f8301731ebb695ffed848cfe71 (diff) | |
download | Nim-2f6d04fd5d302646d40abc60b611653ec58463d0.tar.gz |
strict funcs: use control flow information for a more precise analysis (#15271)
* strict funcs: use control flow information for a more precise analysis * cursor inference uses control flow information
Diffstat (limited to 'tests')
-rw-r--r-- | tests/effects/tfuncs_cannot_mutate.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/effects/tfuncs_cannot_mutate.nim b/tests/effects/tfuncs_cannot_mutate.nim index 2990894ed..4768af2b3 100644 --- a/tests/effects/tfuncs_cannot_mutate.nim +++ b/tests/effects/tfuncs_cannot_mutate.nim @@ -1,9 +1,9 @@ discard """ errormsg: "'mutate' can have side effects" nimout: '''an object reachable from 'n' is potentially mutated -tfuncs_cannot_mutate.nim(34, 15) the mutation is here -tfuncs_cannot_mutate.nim(32, 7) is the statement that connected the mutation to the parameter''' - line: 28 +tfuncs_cannot_mutate.nim(39, 15) the mutation is here +tfuncs_cannot_mutate.nim(37, 7) is the statement that connected the mutation to the parameter''' + line: 33 """ {.experimental: "strictFuncs".} @@ -13,6 +13,11 @@ type le, ri: Node data: string +func insert(x: var seq[Node]; yyy: Node) = + let L = x.len + x.setLen L + 1 + x[L] = yyy + func len(n: Node): int = var it = n while it != nil: |