Bug #17811
Updated by Gaƫtan POBLON over 4 years ago
Generation of a technique in rudder-lang randomly failed for no obvious reason.
After investigation it appeared that this bug were exposed by a duplicate variable declaration located in the rudder-lang library.
The bug was hidden in a recursive function whose purpose was to generate the context tree (which is very important to register variables and their relative namespaces).
Duplicates weren't detected properly (recursion had flow flaws), and when they were (if the duplicate was the first entry of the context tree hashmap) it led to a crash.
Investigating this, I noticed another issue: namespaces weren't push right, ie:
```
sys.arch.linux
sys.arch.windows
```
Would led to
Context { arch { windows } }
instead of:
Context { arch { linux, windows } }
Now program behaves properly:
- warns the user when a duplicate is declared
- properly generates the tree regardless of its elements order
- properly pushes nested content
- added tests unit