WIP: test workaround

This commit is contained in:
Robin van der Linde 2025-08-24 11:28:46 +02:00
parent 4294e49305
commit 48a0a5b520

View file

@ -314,6 +314,14 @@ export class And<T extends TagsFilter = TagsFilter> extends TagsFilter {
for (let j = i + 1; j < optimized.length; j++) {
const ti = optimized[i]
const tj = optimized[j]
if (
!ti ||
!tj ||
typeof ti.shadows !== "function" ||
typeof tj.shadows !== "function"
) {
continue
}
if (ti.shadows(tj)) {
// if 'ti' is true, this implies 'tj' is always true as well.
// if 'ti' is false, then 'tj' might be true or false
@ -322,6 +330,7 @@ export class And<T extends TagsFilter = TagsFilter> extends TagsFilter {
// If 'ti' is true, then 'tj' will be true too and 'tj' can be ignored
// If 'ti' is false, then the entire expression will be false and it doesn't matter what 'tj' yields
optimized.splice(j, 1)
j--
} else if (tj.shadows(ti)) {
optimized.splice(i, 1)
i--