diff --git a/source/dub/dependency.d b/source/dub/dependency.d index 5c88d67..0d2297d 100644 --- a/source/dub/dependency.d +++ b/source/dub/dependency.d @@ -764,7 +764,6 @@ struct Version { private { static immutable MAX_VERS = "99999.0.0"; - static immutable UNKNOWN_VERS = "unknown"; static immutable masterString = "~master"; enum branchPrefix = '~'; string m_version; @@ -773,14 +772,13 @@ static immutable Version minRelease = Version("0.0.0"); static immutable Version maxRelease = Version(MAX_VERS); static immutable Version masterBranch = Version(masterString); - static immutable Version unknown = Version(UNKNOWN_VERS); /** Constructs a new `Version` from its string representation. */ this(string vers) @safe pure { enforce(vers.length > 1, "Version strings must not be empty."); - if (vers[0] != branchPrefix && vers.ptr !is UNKNOWN_VERS.ptr) + if (vers[0] != branchPrefix) enforce(vers.isValidVersion(), "Invalid SemVer format: " ~ vers); m_version = vers; } @@ -819,12 +817,6 @@ return isPreReleaseVersion(m_version); } - /// Tests if this represents the special unknown version constant. - @property bool isUnknown() const scope @safe pure nothrow @nogc - { - return m_version == UNKNOWN_VERS; - } - /** Tests two versions for equality, according to the selected match mode. */ bool matches(in Version other, VersionMatchMode mode = VersionMatchMode.standard) @@ -844,10 +836,6 @@ */ int opCmp(in Version other) const scope @safe pure { - if (isUnknown || other.isUnknown) { - throw new Exception("Can't compare unknown versions! (this: %s, other: %s)".format(this, other)); - } - if (isBranch || other.isBranch) { if(m_version == other.m_version) return 0; if (!isBranch) return 1; @@ -1165,14 +1153,6 @@ for(int j=i-1; j>=0; --j) assert(versions[j] < versions[i], "Failed: " ~ versions[j].toString() ~ "<" ~ versions[i].toString()); - a = Version.unknown; - b = Version.minRelease; - assertThrown(a == b, "Failed: compared " ~ a.toString() ~ " with " ~ b.toString() ~ ""); - - a = Version.unknown; - b = Version.unknown; - assertThrown(a == b, "Failed: UNKNOWN == UNKNOWN"); - assert(Version("1.0.0+a") == Version("1.0.0+b")); assert(Version("1.0.0").matches(Version("1.0.0+foo"))); diff --git a/source/dub/package_.d b/source/dub/package_.d index eee21cf..8ff61eb 100644 --- a/source/dub/package_.d +++ b/source/dub/package_.d @@ -300,7 +300,6 @@ /// ditto void storeInfo(NativePath path) const { - enforce(!version_.isUnknown, "Trying to store a package with an 'unknown' version, this is not supported."); auto filename = path ~ defaultPackageFilename; auto dstFile = openFile(filename.toNativeString(), FileMode.createTrunc); scope(exit) dstFile.close();