Giter Club home page Giter Club logo

Comments (7)

steveklabnik avatar steveklabnik commented on July 20, 2024

Here's the core of it:

[AlphaNumeric("really"), AlphaNumeric("0")] == [AlphaNumeric("really"), Numeric(0)]

these are not considered equal for some reason

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

So the root of the issue is multiple pre sections. With just -really, this works.

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

Hrm, so https://play.rust-lang.org/?gist=f399089d777f3fc4effd&version=stable

#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
pub enum Identifier {
    /// An identifier that's solely numbers.
    Numeric(u64),
    /// An identifier with letters and numbers.
    AlphaNumeric(String)
}

I am confused as to how these two differ. We only use derive for {Partial,}Eq, so...

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

Using the same definitions also works: https://play.rust-lang.org/?gist=cffbc41f771a38132c79&version=stable

ugh.

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

OH: AlphaNumeric("0") vs Numeric(0)

Somehow, these two versions are being parsed differently. That's the problem.

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

Adjusting the test:

        let v1 = VersionReq::parse("2.1.1-really.0").unwrap();
        let v2 = Version::parse("2.1.1-really.0").unwrap();
        println!("v1: {:?}", v1);
        println!("v2: {:?}", v2);

gives

v1: VersionReq { predicates: [Predicate { op: Compatible, major: 2, minor: Some(1), patch: Some(1), pre: [AlphaNumeric("really"), AlphaNumeric("0")] }] }
v2: Version { major: 2, minor: 1, patch: 1, pre: [AlphaNumeric("really"), Numeric(0)], build: [] }

So, it's that VersionReq parsing has a bug: it thinks that 0 is an AlphaNumeric when it should be a Numeric.

If only I had done that nom port already, I bet this wouldn't have happened :(

from semver.

steveklabnik avatar steveklabnik commented on July 20, 2024

PR submitted

from semver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.