mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
* Fix #25820 - handle redirected files when comparing paths * Update test to do case check
This commit is contained in:
+11
-3
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user