@@ -36,7 +36,7 @@ public OverloadResult(ParameterResult[] parameters, string name, string document
36
36
37
37
public string Name { get ; }
38
38
public virtual IReadOnlyList < string > ReturnType => _returnType ;
39
- public virtual string Documentation { get ; }
39
+ public virtual string Documentation { get ; } = string . Empty ;
40
40
public virtual ParameterResult [ ] Parameters => _parameters ;
41
41
42
42
internal virtual OverloadResult WithNewParameters ( ParameterResult [ ] newParameters )
@@ -138,7 +138,7 @@ public override string ToString() {
138
138
}
139
139
140
140
public override bool Equals ( object obj ) {
141
- if ( obj is OverloadResult other ) {
141
+ if ( obj is OverloadResult other ) {
142
142
return OverloadResultComparer . Instance . Equals ( this , other ) ;
143
143
}
144
144
return base . Equals ( obj ) ;
@@ -156,7 +156,7 @@ class AccumulatedOverloadResult {
156
156
157
157
public AccumulatedOverloadResult ( string name , string documentation , int parameters ) {
158
158
_name = name ;
159
- _doc = documentation ;
159
+ _doc = documentation ?? string . Empty ;
160
160
_pnames = new string [ parameters ] ;
161
161
_ptypes = new string [ parameters ] ;
162
162
_pdefaults = new string [ parameters ] ;
@@ -435,35 +435,25 @@ private OverloadResultComparer(bool weak) {
435
435
}
436
436
437
437
public override bool Equals ( OverloadResult x , OverloadResult y ) {
438
- if ( x == null | y == null ) {
439
- return x == null & y == null ;
438
+ if ( x == null || y == null ) {
439
+ return x == null && y == null ;
440
440
}
441
441
442
442
if ( x . Name != y . Name || ( ! _weak && x . Documentation != y . Documentation ) ) {
443
443
return false ;
444
444
}
445
445
446
- if ( x . Parameters == null | y . Parameters == null ) {
447
- return x . Parameters == null & y . Parameters == null ;
446
+ if ( x . Parameters == null || y . Parameters == null ) {
447
+ return x . Parameters == null && y . Parameters == null ;
448
448
}
449
449
450
450
if ( x . Parameters . Length != y . Parameters . Length ) {
451
451
return false ;
452
452
}
453
453
454
- for ( var i = 0 ; i < x . Parameters . Length ; ++ i ) {
455
- if ( _weak ) {
456
- if ( ! x . Parameters [ i ] . Name . Equals ( y . Parameters [ i ] . Name ) ) {
457
- return false ;
458
- }
459
- } else {
460
- if ( ! x . Parameters [ i ] . Equals ( y . Parameters [ i ] ) ) {
461
- return false ;
462
- }
463
- }
464
- }
465
-
466
- return true ;
454
+ return _weak
455
+ ? x . Parameters . Select ( p => p . Name ) . SequenceEqual ( y . Parameters . Select ( p => p . Name ) )
456
+ : x . Parameters . SequenceEqual ( y . Parameters ) ;
467
457
}
468
458
469
459
public override int GetHashCode ( OverloadResult obj ) {
0 commit comments