mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
* Fix #25820 - handle redirected files when comparing paths * Update test to do case check
This commit is contained in:
parent
870c55c7a5
commit
f6d3ac9b5d
@ -2008,9 +2008,17 @@ namespace ts {
|
||||
if (filesByName.has(path)) {
|
||||
const file = filesByName.get(path);
|
||||
// try to check if we've already seen this file but with a different casing in path
|
||||
// NOTE: this only makes sense for case-insensitive file systems
|
||||
if (file && options.forceConsistentCasingInFileNames && getNormalizedAbsolutePath(file.fileName, currentDirectory) !== getNormalizedAbsolutePath(fileName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(fileName, file.fileName, refFile, refPos, refEnd);
|
||||
// NOTE: this only makes sense for case-insensitive file systems, and only on files which are not redirected
|
||||
if (file && options.forceConsistentCasingInFileNames) {
|
||||
let inputName = fileName;
|
||||
const checkedName = file.fileName;
|
||||
const isRedirect = toPath(checkedName) !== toPath(inputName);
|
||||
if (isRedirect) {
|
||||
inputName = getProjectReferenceRedirect(fileName) || fileName;
|
||||
}
|
||||
if (getNormalizedAbsolutePath(checkedName, currentDirectory) !== getNormalizedAbsolutePath(inputName, currentDirectory)) {
|
||||
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
|
||||
}
|
||||
}
|
||||
|
||||
// If the file was previously found via a node_modules search, but is now being processed as a root file,
|
||||
|
||||
@ -2,3 +2,5 @@ import * as c from '../core/index';
|
||||
export function getSecondsInDay() {
|
||||
return c.multiply(10, 15);
|
||||
}
|
||||
import * as mod from '../core/anotherModule';
|
||||
export const m = mod;
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"declaration": true
|
||||
"declaration": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"references": [
|
||||
{ "path": "../core" }
|
||||
|
||||
@ -3,3 +3,6 @@ import * as logic from '../logic/index';
|
||||
|
||||
c.leftPad("", 10);
|
||||
logic.getSecondsInDay();
|
||||
|
||||
import * as mod from '../core/anotherModule';
|
||||
export const m = mod;
|
||||
|
||||
@ -3,5 +3,10 @@
|
||||
{ "path": "../core" },
|
||||
{ "path": "../logic" }
|
||||
],
|
||||
"files": ["index.ts"]
|
||||
"files": ["index.ts"],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"declaration": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user