I've got a simple scenario where I have a defs file like this:
com/example/defs.mlf:
def type exampleDef = {
name: string
};
I can't import it like this:
com/example/post.mlf:
use com.example.defs.exampleDef;
record post {
thing: exampleDef
}
But I can import it like this:
use com.example.defs.exampleDef;
record post {
thing: exampleDef
}
Or like this:
use com.example.defs.{exampleDef};
record post {
thing: exampleDef
}
I have an AI fix for it if you want me to open a PR so you can look at it, but I haven't spent the time to understand it yet, and I'm happy to just use the workaround, now that I realized there is a workaround.
I found that the workaround didn't actually work for
mlf generate, even though it works formlf check.More AI fixing and it looks like the issue is that the
generatecommand wasn't creating a workspace, it was just compiling all the files individually.After the AI fixed that, I also noticed that the generated defs reference is wrong if you import a module module, and then try to reference definitions in that module.
i.e. if I
use com.example.defs.exmpleDefand then in the lexicon, then ref will becom.example.defs#exampleDef, but if Iuse com.example.defsand then I reference it withdefs.exmpleDef, the ref in the lexicon file will be justdefs#exampleDefinstead of having the full path.I guess that should probably be a new issue. This has taken a bit longer than I thought and I do need to get these lexicons going. 😅 I think I'll probably try out typelex real quick to see how that goes.
I don't want to open a mostly-unreviewed AI PR unless you ask for it, but here is the commit that seem to fix this issue if you are interested: https://tangled.org/zicklag.dev/mlf/commit/3a2f4f9cda49c5fbf885dd4c8663ace99e7261e8