Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Count empty function argument
Browse files Browse the repository at this point in the history
  • Loading branch information
foriequal0 committed Mar 28, 2020
1 parent a10b242 commit 88be395
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/comparer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ export function compareTypeParamBound(a: TypeParamBound, b: TypeParamBound): num
}

// a includes b
function includesArray<T>(a: T[], b: T[], include: (lhs: T, rhs: T) => boolean): boolean {
function includesArray<T>(a: T[], b: T[], include: (lhs: T, rhs: T) => boolean, excludeEmpty = true): boolean {
for (let i = 0; i < Math.min(a.length, b.length); i++) {
if (!include(a[i], b[i])) {
return false
}
}
if (a.length > 0 && b.length === 0) {
if (excludeEmpty && a.length > 0 && b.length === 0) {
return false;
}
return a.length >= b.length;
Expand Down Expand Up @@ -234,7 +234,7 @@ export function includes(implA: NormalizedImpl, implB: NormalizedImpl): boolean
if (a.fn != b.fn || a.modifiers != b.modifiers) {
return false;
}
if (!includesArray(a.inputs, b.inputs, includesType)) {
if (!includesArray(a.inputs, b.inputs, includesType, false)) {
return false;
}
if (a.return == null && b.return == null) {
Expand Down

0 comments on commit 88be395

Please sign in to comment.