refuse a closure capturing one name twice
check-capture-names held captures against the parameters and the body, not against each other: (n n) gave C two members and two parameters n.
This commit is contained in:
@@ -498,6 +498,9 @@
|
||||
(test-assert "a capture named like a parameter is refused"
|
||||
(reports? (in-fn "(var c (closure ((int)) int) (closure ((a int)) int (a) (return a)))")
|
||||
"a capture and a parameter share a name"))
|
||||
(test-assert "so is one captured twice"
|
||||
(reports? (in-fn "(var c (closure () int) (closure () int (a a) (return a)))")
|
||||
"two captures share a name"))
|
||||
(test-assert "so is one redeclared at the top of the body"
|
||||
(reports? (in-fn "(var c (closure () int) (closure () int (a) (var a int 5) (return a)))")
|
||||
"the body redeclares a capture"))
|
||||
|
||||
Reference in New Issue
Block a user