-
-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed export package-definitions not including cached modules #3669
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Pedro H C Francisco <75535904+MineTechOficial@users.noreply.github.com>
Signed-off-by: Pedro H C Francisco <75535904+MineTechOficial@users.noreply.github.com>
dd870ca
to
c72c488
Compare
Do I need to write any tests? I didn't write any, just fixed the snapshots. I guess I could duplicate the already existing tests to take account cached modules. |
…piled on export. Removed redundant traits
2013248
to
e67e3c5
Compare
The problem is that, to build the interface from the cache, we'd need to save the typed AST, which I think is less space-efficient than just saving the interface. That's why I rebuild the modules.
|
Neither of those approaches are what we want. Does the cache not have enough information to build the module interface JSON from? What's missing? |
As the package interface is built from various module interfaces, each of these being built from all the definitions, it needs to be built from the typed AST, which isn't cached
|
Why does it need to be built from typed AST? What information do they hold that the interface JSON needs that the cache does not have? |
I tried adapting the
|
The cache has all the type information for a compiled module, so you can use that. |
From when I looked into implementing this, it seems the main limitation is type aliases. Type alias information isn't stored in the cached interface, so that would need to be accessed somehow |
After trying to adapt the `from_module` function of the `ModuleInterface` struct from the `package_interface` module to work with `UncompiledModule` and `ModuleInterface` (from the `type_` module) and, as Gears pointed out, it seems that the only thing missing in the cache is the type aliases.
|
You don't need |
I think I might need add a HashMap of TypeAlias to the ModuleInterface struct. Is that okay?
|
I've been doing this and I've stumbled onto a problem: somehow, when the code will encode the modules to the cache, somehow the documentations have an extra newline? Do I have to somehow fix it or can I leave it like so? |
I would say if you can reproduce the bug without your changes, then open a separate issue and let that be fixed separately. If this PR introduces that bug, then please fix it |
I can actually reproduce it separately, will open an issue for it then |
Issue opened at #3712 |
Now it reuses as much of the cache as possible, although there is a test failing and I don't know why (need to fix). I'll open for review just to make sure any of the overall logic isn't wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far! Thank you
…ain backwards compatibility
Uhm, apparently this kind of broke the LSP, as it isn't considering the type aliases anymore. Guess I'll also need to tweak it |
I think it should be all done now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Looking good. I've left some questions inline
deprecation: deprecation.clone(), | ||
publicity: *publicity, | ||
// TODO: Find if the type is opaque |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? Is it unfinished?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot about this todo 😅. Is there a problem for the code to register the type alias as a non-opaque type, just for type analysis?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of any problems, but I'm not sure what you mean here.
Hey @lpil, left some answers to your questions. Waiting for some answers! |
Hey @lpil, I've been trying to rewrite the type analysis so that it doesn't need to register the type aliases as types just for the analysis, but the |
Actually I still need to discover what the parameters of the |
Hey @lpil, do you think it's ok for me to leave the PR with the odd way of registering type aliases as "normal types" just for the analysis, and removing it later (as I still couldn't find a good way to consider it separately), or do you want me to try and fix it anyway? |
Hi @mine-tech-oficial, are you still working on this PR? If not, I'm happy to pick up the work as it would be cool to get this fixed. Thanks! |
@GearsDatapacks, actually for the past few weeks I didn't do much progress due to not having much time, although I was writing some code to get the labels of the parameters |
@lpil, now I think I only need to find the documentation (not sure how though) |
@@ -90,6 +90,11 @@ struct RecordAccessor { | |||
label @2 :Text; | |||
} | |||
|
|||
struct FunctionArgument { | |||
name @0 :Text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function types don't contain names! Please remove this.
It would also be called a parameter. Things have parameters, and for those parameters they accept arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you mean that a parameter has a name/label, while an argument doesn't? In that case, I'd reuse the TypeValueConstructorParameter
struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fair I wasn't happy with the approach I took 😅 . Tomorrow I'll try tackling this again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neither has names at the type level, but parameters can have names locally within a definition.
Hey @lpil, I've left a comment on your answers. Waiting for you to confirm it! (no rush by the way) |
This PR closes #2898