crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

Inconsistency in `~> x.y.z` requirement with pre-release #570

Closed Blacksmoke16 closed 1 year ago

Blacksmoke16 commented 1 year ago

TBD if this is just a documentation issue, or a legitimate bug. But the docs call out ~> 2.0.3 is identical to >= 2.0.3 and < 2.1;. Assuming the ; is a typo and doesn't have some special meaning, it is expected that the following test cases pass when comparing against a version with a pre-release:

matches?("2.1.0-dev", "<2.1").should be_true
matches?("2.1.0-dev", ">=2.0.3").should be_true
matches?("2.1.0-dev", ">=2.0.3, <2.1").should be_true

However, matches?("2.1.0-dev", "~> 2.0.3").should be_true does not.

So either the docs are wrong given its not identical, or this just is an actual bug that needs handled in the code.

straight-shoota commented 1 year ago

I think the docs are a bit imprecise. It's not just < 2.1 but also excludes any pre-release of 2.1. I think that makes most sense for the semantics of this operator.