purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.47k stars 308 forks source link

lang: ast: Clear env in VarExpr.Graph #721

Closed gelisam closed 8 months ago

gelisam commented 9 months ago

Variables are defined at the top-level, where only obj.Scope variables are in scope. The lambda parameters which are in scope where the variable is used must not be in scope where the variable is defined. This test detects future mistakes in which we make a recursive call with the same environment as the use site instead of clearing the env.

The test passes with or without the fix, because an earlier phase (SetScope) already clears the env, thus triggering a compile-time error.

purpleidea commented 8 months ago

Awesome! LGTM I will merge shortly!

purpleidea commented 8 months ago

Done, thank you!