Skip to content

Commit 7156300

Browse files
authored
Fix unwanted constant comparisons potentially causing bugs (#61655)
1 parent 0ee67b5 commit 7156300

8 files changed

+522
-522
lines changed

src/compiler/resolutionCache.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ export function canWatchAtTypes(atTypes: Path): boolean {
324324
}
325325

326326
function isInDirectoryPath(dirComponents: Readonly<PathPathComponents>, fileOrDirComponents: Readonly<PathPathComponents>) {
327-
if (fileOrDirComponents.length < fileOrDirComponents.length) return false;
327+
if (fileOrDirComponents.length < dirComponents.length) return false;
328328
for (let i = 0; i < dirComponents.length; i++) {
329329
if (fileOrDirComponents[i] !== dirComponents[i]) return false;
330330
}

src/harness/fourslashImpl.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2603,9 +2603,9 @@ export class TestState {
26032603
const sorted = items.slice();
26042604
// sort by file, then *backwards* by position in the file so I can insert multiple times on a line without counting
26052605
sorted.sort((q1, q2) =>
2606-
q1.marker.fileName === q1.marker.fileName
2606+
q1.marker.fileName === q2.marker.fileName
26072607
? (q1.marker.position > q2.marker.position ? -1 : 1)
2608-
: (q1.marker.fileName > q1.marker.fileName ? 1 : -1)
2608+
: (q1.marker.fileName > q2.marker.fileName ? 1 : -1)
26092609
);
26102610
const files = new Map<string, string[]>();
26112611
let previous: T | undefined;

0 commit comments

Comments
 (0)