Closed chrisdp closed 3 years ago
This actually has nothing to do with namespaces, it's caused by circular imports. This test will cause it too:
it('circular reference does not cause stack overflow', () => {
program.addOrReplaceFile('components/a.bs', `
import "b.bs"
`);
program.addOrReplaceFile('components/b.bs', `
import "a.bs"
`);
//this is the test. if validation succeeds, there's no stack overflow
program.validate();
});
Example: you have a namespace called
Types
and a namespace calledGetter
Getter
usesTypes
to validate object types. So for exampleGetter.Boolean(object, "path.in.object")
will useTypes.isBoolean(value)
under the hood andTypes
internally might useGetter.<type>()
under the hood for safe object traversal. As a result they import each other leading to the above crash.