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
This commit is contained in:
Andreas Rumpf 2020-09-06 22:01:39 +02:00 • committed by GitHub
commit 2f6d04fd5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 87 additions and 23 deletions

View file

@ -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: