Skip to content
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

Relax semver-checks to compare worlds in packages with different versions #1886

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/wit-component/src/semver_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn semver_check(mut resolve: Resolve, prev: WorldId, new: WorldId) -> Result
.package
.context("new world not in named package")?;
let new_pkg_name = &resolve.packages[new_pkg_id].name;
if old_pkg_id != new_pkg_id {
if old_pkg_name != new_pkg_name {
bail!("the old world is in package {old_pkg_name}, which is not the same as the new world, which is in package {new_pkg_name}", )
}

Expand Down
14 changes: 14 additions & 0 deletions tests/cli/semver-check-different-package-versions.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// FAIL: component semver-check % --prev a:b/[email protected] --new a:b/[email protected]

package foo:root;
package a:[email protected] {
world worldly {
import a: func();
import b: interface {}
}
}

package a:[email protected] {
world worldly {
}
}
5 changes: 5 additions & 0 deletions tests/cli/semver-check-different-package-versions.wit.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error: new world is not semver-compatible with the previous world

Caused by:
0: type mismatch for import `worldly`
missing import named `a` (at offset 0x186)