DA.Daml.LF.Ast.Optics provides a suite of functions whose main use is finding the referenced modules on pretty much every part of the AST.
While we use typeModuleRef from this module as part of figuring out module refs in TypeScript codegen, it seems that we do a lot of calculating of Set ModuleRefs that just might be redoing the work of this module.
We should see whether all of the module ref tracking in TsCodeGenMain can't be replaced with some well-chosen invocations of the traversal provided by Optics. That would probably have precluded #13754, and may also help us avoid similar bugs that might arise with future LF features.
DA.Daml.LF.Ast.Optics
provides a suite of functions whose main use is finding the referenced modules on pretty much every part of the AST.While we use
typeModuleRef
from this module as part of figuring out module refs in TypeScript codegen, it seems that we do a lot of calculating ofSet ModuleRef
s that just might be redoing the work of this module.We should see whether all of the module ref tracking in
TsCodeGenMain
can't be replaced with some well-chosen invocations of the traversal provided byOptics
. That would probably have precluded #13754, and may also help us avoid similar bugs that might arise with future LF features.