Merge pull request #25909 from weswigham/port-25902

Ports #25902 to `release-3.0`
This commit is contained in:
Mohamed Hegazy
2018-07-24 16:43:04 -07:00
committed by GitHub
5 changed files with 24 additions and 5 deletions

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,