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
This commit is contained in:
parent
c7493bbdd0
commit
3812d91390
14 changed files with 187 additions and 78 deletions
|
|
@ -1,9 +1,6 @@
|
|||
discard """
|
||||
errormsg: "'mutate' can have side effects"
|
||||
nimout: '''an object reachable from 'n' is potentially mutated
|
||||
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
|
||||
'''
|
||||
errormsg: "cannot mutate location select(x, z).data within a strict func"
|
||||
line: 35
|
||||
"""
|
||||
|
||||
{.experimental: "strictFuncs".}
|
||||
|
|
@ -25,8 +22,7 @@ func len(n: Node): int =
|
|||
it = it.ri
|
||||
|
||||
func doNotDistract(n: Node) =
|
||||
var m = Node()
|
||||
m.data = "abc"
|
||||
var m = Node(data: "abc")
|
||||
|
||||
func select(a, b: Node): Node = b
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue