@@ -124,14 +124,19 @@ struct Dependency {
124
124
// Shortcut to create >=0.0.0
125
125
private enum ANY_IDENT = " *" ;
126
126
127
- private Value m_value;
127
+ private Value m_value = Value(VersionRange.Invalid) ;
128
128
private bool m_optional;
129
129
private bool m_default;
130
130
131
131
// / A Dependency, which matches every valid version.
132
- static @property Dependency any() @safe { return Dependency(VersionRange.Any); }
132
+ public static immutable Dependency Any = Dependency(VersionRange.Any);
133
133
134
134
// / An invalid dependency (with no possible version matches).
135
+ public static immutable Dependency Invalid = Dependency(VersionRange.Invalid);
136
+
137
+ deprecated (" Use `Dependency.Any` instead" )
138
+ static @property Dependency any() @safe { return Dependency(VersionRange.Any); }
139
+ deprecated (" Use `Dependency.Invalid` instead" )
135
140
static @property Dependency invalid() @safe
136
141
{
137
142
return Dependency (VersionRange.Invalid);
@@ -510,11 +515,11 @@ struct Dependency {
510
515
*/
511
516
Dependency merge (ref const (Dependency) o) const @trusted {
512
517
alias Merger = match! (
513
- (const NativePath a, const NativePath b) => a == b ? this : invalid ,
518
+ (const NativePath a, const NativePath b) => a == b ? this : Invalid ,
514
519
(const NativePath a, any ) => o,
515
520
( any , const NativePath b) => this ,
516
521
517
- (const Repository a, const Repository b) => a.m_ref == b.m_ref ? this : invalid ,
522
+ (const Repository a, const Repository b) => a.m_ref == b.m_ref ? this : Invalid ,
518
523
(const Repository a, any ) => this ,
519
524
( any , const Repository b) => o,
520
525
@@ -524,7 +529,7 @@ struct Dependency {
524
529
525
530
VersionRange copy = a;
526
531
copy.merge(b);
527
- if (! copy.isValid()) return invalid ;
532
+ if (! copy.isValid()) return Invalid ;
528
533
return Dependency (copy);
529
534
}
530
535
);
@@ -682,7 +687,7 @@ unittest {
682
687
assert (a.valid);
683
688
assert (a.version_ == Version(" ~d2test" ));
684
689
685
- a = Dependency.any ;
690
+ a = Dependency.Any ;
686
691
assert (! a.optional);
687
692
assert (a.valid);
688
693
assertThrown(a.version_);
0 commit comments