Just noticed this had an update 9 days ago, and thought I should update with the conclusion back then.
This was for the Verona language, where we were lowering AST to MLIR. Verona had a module system, so it “felt natural” to use MLIR’s module system to represent it.
What I was looking for is if there was any intent for this to be supported (and I was doing something wrong) or if there wasn’t (and support would need to be added/worked around). Turns out it was the latter, which is perfectly fine.
At the time, I decided to flatten the modules using name mangling (__Foo_Bar
etc), which worked fine for calling functions. We also had to mangle the global symbol table, which in retrospect was simpler than descending sub-modules to search in their own symbol tables.