Fix #25820 - handle redirected files when comparing paths (#25902)

* Fix #25820 - handle redirected files when comparing paths

* Update test to do case check
This commit is contained in:
Wesley Wigham
2018-07-24 15:24:52 -07:00
committed by GitHub
parent 870c55c7a5
commit f6d3ac9b5d
5 changed files with 24 additions and 5 deletions
+11 -3
View File
@@ -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,