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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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,

View 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;

View File

@ -1,7 +1,8 @@
{
"compilerOptions": {
"composite": true,
"declaration": true
"declaration": true,
"forceConsistentCasingInFileNames": true
},
"references": [
{ "path": "../core" }

View File

@ -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;

View File

@ -3,5 +3,10 @@
{ "path": "../core" },
{ "path": "../logic" }
],
"files": ["index.ts"]
"files": ["index.ts"],
"compilerOptions": {
"composite": true,
"declaration": true,
"forceConsistentCasingInFileNames": true
}
}