Skip to content

Conversation

@IanButterworth
Copy link
Member

Fixes #4554

🤖 Written by Claude:


When freeing a dev'd or pinned package, pkg.version could remain as a VersionSpec in certain code paths, but PackageEntry requires version::Union{VersionNumber, Nothing}. This caused a MethodError when trying to convert VersionSpec to VersionNumber.

The issue occurred because:

  1. When freeing a package from dev/path/repo state, the version might not be updated through the normal resolve process
  2. In some cases (e.g., pinned stdlibs), update_package_free! returns early without setting the version
  3. The PackageEntry constructor was called with pkg.version which could be a VersionSpec, causing a type conversion error

This fix adds defensive type checking before creating PackageEntry objects, converting non-VersionNumber values to nothing. The correct version will be set later if needed (e.g., for stdlibs).

Fixes JuliaLang#4554

When freeing a dev'd or pinned package, `pkg.version` could remain as
a `VersionSpec` in certain code paths, but `PackageEntry` requires
`version::Union{VersionNumber, Nothing}`. This caused a MethodError
when trying to convert VersionSpec to VersionNumber.

The issue occurred because:
1. When freeing a package from dev/path/repo state, the version might
   not be updated through the normal resolve process
2. In some cases (e.g., pinned stdlibs), `update_package_free!` returns
   early without setting the version
3. The `PackageEntry` constructor was called with `pkg.version` which
   could be a `VersionSpec`, causing a type conversion error

This fix adds defensive type checking before creating `PackageEntry`
objects, converting non-VersionNumber values to `nothing`. The correct
version will be set later if needed (e.g., for stdlibs).

Changes:
- src/Operations.jl: Added type check in update_manifest!
- src/Apps/Apps.jl: Added type checks in two PackageEntry creations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Error when freeing dev'd package: Cannot convert VersionSpec to VersionNumber

1 participant