feat(vim.version): add __eq to vim.VersionRange #38881

Problem: vim.VersionRange had no __eq metamethod, so comparing 2 distinct
but same value instances always returned false. In vim.pack.add this caused
redundant lockfile rewrites, even when the resulting lockfile content was
unchanged.

Solution: Add __eq metamethod on vim.VersionRange
This commit is contained in:
ngicks
2026-04-09 02:33:00 +09:00
committed by GitHub
parent 7e4d484c9d
commit a165eee64f
3 changed files with 19 additions and 1 deletions

View File

@@ -273,6 +273,9 @@ end
local range_mt = {
__index = VersionRange,
__eq = function(self, other)
return self.to == other.to and self.from == other.from
end,
__tostring = function(self)
if not self.to then
return '>=' .. tostring(self.from)