Preserve the version metadata in wit merge#2078
Preserve the version metadata in wit merge#2078alexcrichton merged 2 commits intobytecodealliance:mainfrom
Conversation
Signed-off-by: James Sturtevant <jstur@microsoft.com>
Signed-off-by: James Sturtevant <jstur@microsoft.com>
eea9a22 to
3c097eb
Compare
|
@alexcrichton This is ready for a review, I wasn't able to refactor as much as I initiall thought since the semantics in the various places were slightly different even though the code looked similar. If you have ideas or suggestions be happy to try again. |
| for from_import in world.imports.iter() { | ||
| Resolve::update_world_imports_stability( | ||
| from_import, | ||
| &mut self.worlds[world_id].imports, | ||
| &interface_map, | ||
| )?; | ||
| } | ||
| for from_export in world.exports.iter() { | ||
| Resolve::update_world_imports_stability( | ||
| from_export, | ||
| &mut self.worlds[world_id].exports, | ||
| &interface_map, | ||
| )?; | ||
| } |
There was a problem hiding this comment.
How come this was necessary? I would have expected that by the time we merge things include has already been fully expanded and such.
Is the issue though that imports/exports have different stabilities depending on whether they came from an include or not?
There was a problem hiding this comment.
The include is fully expanded at this point but the stability information wasn't copied over. I did look at coping the version info over when it was merging, but it looked like when the merging was done the id's were copied over and the stability updates where happening at a later point here.
Is the issue though that imports/exports have different stabilities depending on whether they came from an
includeor not?
even in worlds without includes the version wasn't copied over. For instance the since was missing on the from in the shared-world-with-versions. When I reversed from and into in the test it did the opposite.
world shared-world-with-versions {
@since(version = 1.0.0) // this was missing
import shared-version-on-from;
There was a problem hiding this comment.
Aha I understand now, thanks for expanding!
| for from_import in world.imports.iter() { | ||
| Resolve::update_world_imports_stability( | ||
| from_import, | ||
| &mut self.worlds[world_id].imports, | ||
| &interface_map, | ||
| )?; | ||
| } | ||
| for from_export in world.exports.iter() { | ||
| Resolve::update_world_imports_stability( | ||
| from_export, | ||
| &mut self.worlds[world_id].exports, | ||
| &interface_map, | ||
| )?; | ||
| } |
There was a problem hiding this comment.
Aha I understand now, thanks for expanding!
* Preserve the version metadata in wit Signed-off-by: James Sturtevant <jstur@microsoft.com> * Add test case for exports Signed-off-by: James Sturtevant <jstur@microsoft.com> --------- Signed-off-by: James Sturtevant <jstur@microsoft.com>
Follow up to #2076 where I found this issue.
It is expected that when merging two worlds the versions are preserved. For instance the merge should preserve the
@sincefor the into and the from.given shared world 1:
And shared world 2:
It is expected to see: