From 6dcf3cf75696d79a7f422ab8a7f423bc36352aed Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Nov 2015 12:06:25 -0800 Subject: [PATCH 01/11] Add case sensitivity-check, only error on failure when outDir is specified and resource based paths are found --- src/compiler/program.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 8f031a4de43..aee66834a11 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -888,7 +888,7 @@ namespace ts { function computeCommonSourceDirectory(sourceFiles: SourceFile[]): string { let commonPathComponents: string[]; - forEach(files, sourceFile => { + const failed = forEach(files, sourceFile => { // Each file contributes into common source file path if (isDeclarationFile(sourceFile)) { return; @@ -903,11 +903,12 @@ namespace ts { return; } + const caseSensitive = host.useCaseSensitiveFileNames(); for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (caseSensitive ? commonPathComponents[i] !== sourcePathComponents[i] : commonPathComponents[i].toLocaleLowerCase() !== sourcePathComponents[i].toLocaleLowerCase()) { if (i === 0) { - programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); - return; + // Failed to find any common path component + return true; } // New common path found that is 0 -> i-1 @@ -922,6 +923,11 @@ namespace ts { } }); + // A common path can not be found when paths span multiple drives on windows, for example + if (failed) { + return ""; + } + if (!commonPathComponents) { // Can happen when all input files are .d.ts files return currentDirectory; } @@ -1045,6 +1051,10 @@ namespace ts { else { // Compute the commonSourceDirectory from the input files commonSourceDirectory = computeCommonSourceDirectory(files); + // If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure + if (options.outDir && commonSourceDirectory === "" && forEach(files, file => getRootLength(file.fileName) > 1)) { + programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + } } if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { From 97d170b388102bded0fdd68384c3a43b4f871fe6 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Nov 2015 13:10:44 -0800 Subject: [PATCH 02/11] Support to tests for absolute paths, add common src dir edgecase tests --- src/harness/compilerRunner.ts | 22 ++++++------------- tests/baselines/reference/commonSourceDir1.js | 13 +++++++++++ .../reference/commonSourceDir1.symbols | 8 +++++++ .../reference/commonSourceDir1.types | 8 +++++++ .../reference/commonSourceDir2.errors.txt | 9 ++++++++ tests/baselines/reference/commonSourceDir2.js | 12 ++++++++++ tests/baselines/reference/commonSourceDir3.js | 12 ++++++++++ .../reference/commonSourceDir3.symbols | 8 +++++++ .../reference/commonSourceDir3.types | 8 +++++++ .../reference/commonSourceDir4.errors.txt | 9 ++++++++ tests/baselines/reference/commonSourceDir4.js | 12 ++++++++++ tests/cases/compiler/commonSourceDir1.ts | 6 +++++ tests/cases/compiler/commonSourceDir2.ts | 6 +++++ tests/cases/compiler/commonSourceDir3.ts | 6 +++++ tests/cases/compiler/commonSourceDir4.ts | 7 ++++++ 15 files changed, 131 insertions(+), 15 deletions(-) create mode 100644 tests/baselines/reference/commonSourceDir1.js create mode 100644 tests/baselines/reference/commonSourceDir1.symbols create mode 100644 tests/baselines/reference/commonSourceDir1.types create mode 100644 tests/baselines/reference/commonSourceDir2.errors.txt create mode 100644 tests/baselines/reference/commonSourceDir2.js create mode 100644 tests/baselines/reference/commonSourceDir3.js create mode 100644 tests/baselines/reference/commonSourceDir3.symbols create mode 100644 tests/baselines/reference/commonSourceDir3.types create mode 100644 tests/baselines/reference/commonSourceDir4.errors.txt create mode 100644 tests/baselines/reference/commonSourceDir4.js create mode 100644 tests/cases/compiler/commonSourceDir1.ts create mode 100644 tests/cases/compiler/commonSourceDir2.ts create mode 100644 tests/cases/compiler/commonSourceDir3.ts create mode 100644 tests/cases/compiler/commonSourceDir4.ts diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 848f229f109..f7bb23527dd 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -45,14 +45,10 @@ class CompilerBaselineRunner extends RunnerBase { // Mocha holds onto the closure environment of the describe callback even after the test is done. // Everything declared here should be cleared out in the "after" callback. let justName: string; - let content: string; - let testCaseContent: { settings: Harness.TestCaseParser.CompilerSettings; testUnitData: Harness.TestCaseParser.TestUnitData[]; }; - let units: Harness.TestCaseParser.TestUnitData[]; let tcSettings: Harness.TestCaseParser.CompilerSettings; let lastUnit: Harness.TestCaseParser.TestUnitData; - let rootDir: string; let result: Harness.Compiler.CompilerResult; let program: ts.Program; @@ -65,12 +61,12 @@ class CompilerBaselineRunner extends RunnerBase { before(() => { justName = fileName.replace(/^.*[\\\/]/, ""); // strips the fileName from the path. - content = Harness.IO.readFile(fileName); - testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName); - units = testCaseContent.testUnitData; + const content = Harness.IO.readFile(fileName); + const testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName); + const units = testCaseContent.testUnitData; tcSettings = testCaseContent.settings; lastUnit = units[units.length - 1]; - rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/"; + const rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/"; harnessCompiler = Harness.Compiler.getCompiler(); // We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test) // If the last file in a test uses require or a triple slash reference we'll assume all other files will be brought in via references, @@ -78,16 +74,16 @@ class CompilerBaselineRunner extends RunnerBase { toBeCompiled = []; otherFiles = []; if (/require\(/.test(lastUnit.content) || /reference\spath/.test(lastUnit.content)) { - toBeCompiled.push({ unitName: rootDir + lastUnit.name, content: lastUnit.content }); + toBeCompiled.push({ unitName: ts.isRootedDiskPath(lastUnit.name) ? lastUnit.name : rootDir + lastUnit.name, content: lastUnit.content }); units.forEach(unit => { if (unit.name !== lastUnit.name) { - otherFiles.push({ unitName: rootDir + unit.name, content: unit.content }); + otherFiles.push({ unitName: ts.isRootedDiskPath(unit.name) ? unit.name : rootDir + unit.name, content: unit.content }); } }); } else { toBeCompiled = units.map(unit => { - return { unitName: rootDir + unit.name, content: unit.content }; + return { unitName: ts.isRootedDiskPath(unit.name) ? unit.name : rootDir + unit.name, content: unit.content }; }); } @@ -104,12 +100,8 @@ class CompilerBaselineRunner extends RunnerBase { // Mocha holds onto the closure environment of the describe callback even after the test is done. // Therefore we have to clean out large objects after the test is done. justName = undefined; - content = undefined; - testCaseContent = undefined; - units = undefined; tcSettings = undefined; lastUnit = undefined; - rootDir = undefined; result = undefined; program = undefined; options = undefined; diff --git a/tests/baselines/reference/commonSourceDir1.js b/tests/baselines/reference/commonSourceDir1.js new file mode 100644 index 00000000000..68833aed49d --- /dev/null +++ b/tests/baselines/reference/commonSourceDir1.js @@ -0,0 +1,13 @@ +//// [tests/cases/compiler/commonSourceDir1.ts] //// + +//// [bar.ts] +var x: number; + +//// [baz.ts] +var y: number; + + +//// [bar.js] +var x; +//// [baz.js] +var y; diff --git a/tests/baselines/reference/commonSourceDir1.symbols b/tests/baselines/reference/commonSourceDir1.symbols new file mode 100644 index 00000000000..9248e0c97af --- /dev/null +++ b/tests/baselines/reference/commonSourceDir1.symbols @@ -0,0 +1,8 @@ +=== A:/foo/bar.ts === +var x: number; +>x : Symbol(x, Decl(bar.ts, 0, 3)) + +=== A:/foo/baz.ts === +var y: number; +>y : Symbol(y, Decl(baz.ts, 0, 3)) + diff --git a/tests/baselines/reference/commonSourceDir1.types b/tests/baselines/reference/commonSourceDir1.types new file mode 100644 index 00000000000..6c9864c02cc --- /dev/null +++ b/tests/baselines/reference/commonSourceDir1.types @@ -0,0 +1,8 @@ +=== A:/foo/bar.ts === +var x: number; +>x : number + +=== A:/foo/baz.ts === +var y: number; +>y : number + diff --git a/tests/baselines/reference/commonSourceDir2.errors.txt b/tests/baselines/reference/commonSourceDir2.errors.txt new file mode 100644 index 00000000000..85bcf5d9c72 --- /dev/null +++ b/tests/baselines/reference/commonSourceDir2.errors.txt @@ -0,0 +1,9 @@ +error TS5009: Cannot find the common subdirectory path for the input files. + + +!!! error TS5009: Cannot find the common subdirectory path for the input files. +==== A:/foo/bar.ts (0 errors) ==== + var x: number; + +==== B:/foo/baz.ts (0 errors) ==== + var y: number; \ No newline at end of file diff --git a/tests/baselines/reference/commonSourceDir2.js b/tests/baselines/reference/commonSourceDir2.js new file mode 100644 index 00000000000..cf263b51fb6 --- /dev/null +++ b/tests/baselines/reference/commonSourceDir2.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/commonSourceDir2.ts] //// + +//// [bar.ts] +var x: number; + +//// [baz.ts] +var y: number; + +//// [bar.js] +var x; +//// [baz.js] +var y; diff --git a/tests/baselines/reference/commonSourceDir3.js b/tests/baselines/reference/commonSourceDir3.js new file mode 100644 index 00000000000..0535d51f4bf --- /dev/null +++ b/tests/baselines/reference/commonSourceDir3.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/commonSourceDir3.ts] //// + +//// [bar.ts] +var x: number; + +//// [baz.ts] +var y: number; + +//// [bar.js] +var x; +//// [baz.js] +var y; diff --git a/tests/baselines/reference/commonSourceDir3.symbols b/tests/baselines/reference/commonSourceDir3.symbols new file mode 100644 index 00000000000..b8783523dfd --- /dev/null +++ b/tests/baselines/reference/commonSourceDir3.symbols @@ -0,0 +1,8 @@ +=== A:/foo/bar.ts === +var x: number; +>x : Symbol(x, Decl(bar.ts, 0, 3)) + +=== a:/foo/baz.ts === +var y: number; +>y : Symbol(y, Decl(baz.ts, 0, 3)) + diff --git a/tests/baselines/reference/commonSourceDir3.types b/tests/baselines/reference/commonSourceDir3.types new file mode 100644 index 00000000000..a0b95275897 --- /dev/null +++ b/tests/baselines/reference/commonSourceDir3.types @@ -0,0 +1,8 @@ +=== A:/foo/bar.ts === +var x: number; +>x : number + +=== a:/foo/baz.ts === +var y: number; +>y : number + diff --git a/tests/baselines/reference/commonSourceDir4.errors.txt b/tests/baselines/reference/commonSourceDir4.errors.txt new file mode 100644 index 00000000000..f3493504e4d --- /dev/null +++ b/tests/baselines/reference/commonSourceDir4.errors.txt @@ -0,0 +1,9 @@ +error TS5009: Cannot find the common subdirectory path for the input files. + + +!!! error TS5009: Cannot find the common subdirectory path for the input files. +==== A:/foo/bar.ts (0 errors) ==== + var x: number; + +==== a:/foo/baz.ts (0 errors) ==== + var y: number; \ No newline at end of file diff --git a/tests/baselines/reference/commonSourceDir4.js b/tests/baselines/reference/commonSourceDir4.js new file mode 100644 index 00000000000..2f2af9f68b2 --- /dev/null +++ b/tests/baselines/reference/commonSourceDir4.js @@ -0,0 +1,12 @@ +//// [tests/cases/compiler/commonSourceDir4.ts] //// + +//// [bar.ts] +var x: number; + +//// [baz.ts] +var y: number; + +//// [bar.js] +var x; +//// [baz.js] +var y; diff --git a/tests/cases/compiler/commonSourceDir1.ts b/tests/cases/compiler/commonSourceDir1.ts new file mode 100644 index 00000000000..1a178ac0226 --- /dev/null +++ b/tests/cases/compiler/commonSourceDir1.ts @@ -0,0 +1,6 @@ +// @outDir: A:/ +// @Filename: A:/foo/bar.ts +var x: number; + +// @Filename: A:/foo/baz.ts +var y: number; diff --git a/tests/cases/compiler/commonSourceDir2.ts b/tests/cases/compiler/commonSourceDir2.ts new file mode 100644 index 00000000000..68dab0727a3 --- /dev/null +++ b/tests/cases/compiler/commonSourceDir2.ts @@ -0,0 +1,6 @@ +// @outDir: A:/ +// @Filename: A:/foo/bar.ts +var x: number; + +// @Filename: B:/foo/baz.ts +var y: number; \ No newline at end of file diff --git a/tests/cases/compiler/commonSourceDir3.ts b/tests/cases/compiler/commonSourceDir3.ts new file mode 100644 index 00000000000..cc42eb8f267 --- /dev/null +++ b/tests/cases/compiler/commonSourceDir3.ts @@ -0,0 +1,6 @@ +// @outDir: A:/ +// @Filename: A:/foo/bar.ts +var x: number; + +// @Filename: a:/foo/baz.ts +var y: number; \ No newline at end of file diff --git a/tests/cases/compiler/commonSourceDir4.ts b/tests/cases/compiler/commonSourceDir4.ts new file mode 100644 index 00000000000..41ee7a0344a --- /dev/null +++ b/tests/cases/compiler/commonSourceDir4.ts @@ -0,0 +1,7 @@ +// @useCaseSensitiveFileNames: true +// @outDir: A:/ +// @Filename: A:/foo/bar.ts +var x: number; + +// @Filename: a:/foo/baz.ts +var y: number; \ No newline at end of file From a1cf51faacf18f4a3f91530688ec2c77fefd698d Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Nov 2015 13:25:09 -0800 Subject: [PATCH 03/11] use canonical filename function --- src/compiler/program.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index aee66834a11..03305dd368d 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -894,7 +894,7 @@ namespace ts { return; } - const sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory); + const sourcePathComponents = getNormalizedPathComponents(getCanonicalFileName(sourceFile.fileName), currentDirectory); sourcePathComponents.pop(); // The base file name is not part of the common directory path if (!commonPathComponents) { @@ -903,9 +903,8 @@ namespace ts { return; } - const caseSensitive = host.useCaseSensitiveFileNames(); for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (caseSensitive ? commonPathComponents[i] !== sourcePathComponents[i] : commonPathComponents[i].toLocaleLowerCase() !== sourcePathComponents[i].toLocaleLowerCase()) { + if (commonPathComponents[i] !== sourcePathComponents[i]) { if (i === 0) { // Failed to find any common path component return true; From ebd7d2d93e914819f1b15b4e7e75d7da3905adad Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 10 Nov 2015 16:48:08 -0800 Subject: [PATCH 04/11] extract method --- src/harness/compilerRunner.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index f7bb23527dd..4a599e96812 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -40,6 +40,10 @@ class CompilerBaselineRunner extends RunnerBase { this.basePath += "/" + this.testSuiteName; } + private makeUnitName(name: string, root: string) { + return ts.isRootedDiskPath(name) ? name : (root + name); + }; + public checkTestCodeOutput(fileName: string) { describe("compiler tests for " + fileName, () => { // Mocha holds onto the closure environment of the describe callback even after the test is done. @@ -74,16 +78,16 @@ class CompilerBaselineRunner extends RunnerBase { toBeCompiled = []; otherFiles = []; if (/require\(/.test(lastUnit.content) || /reference\spath/.test(lastUnit.content)) { - toBeCompiled.push({ unitName: ts.isRootedDiskPath(lastUnit.name) ? lastUnit.name : rootDir + lastUnit.name, content: lastUnit.content }); + toBeCompiled.push({ unitName: this.makeUnitName(lastUnit.name, rootDir), content: lastUnit.content }); units.forEach(unit => { if (unit.name !== lastUnit.name) { - otherFiles.push({ unitName: ts.isRootedDiskPath(unit.name) ? unit.name : rootDir + unit.name, content: unit.content }); + otherFiles.push({ unitName: this.makeUnitName(unit.name, rootDir), content: unit.content }); } }); } else { toBeCompiled = units.map(unit => { - return { unitName: ts.isRootedDiskPath(unit.name) ? unit.name : rootDir + unit.name, content: unit.content }; + return { unitName: this.makeUnitName(unit.name, rootDir), content: unit.content }; }); } From 5ea25ba9a09f5a9860b92093012a3cedd32bf664 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Wed, 11 Nov 2015 10:57:32 -0800 Subject: [PATCH 05/11] remove whitespace --- src/harness/compilerRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 4a599e96812..011b10e4e6b 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -43,7 +43,7 @@ class CompilerBaselineRunner extends RunnerBase { private makeUnitName(name: string, root: string) { return ts.isRootedDiskPath(name) ? name : (root + name); }; - + public checkTestCodeOutput(fileName: string) { describe("compiler tests for " + fileName, () => { // Mocha holds onto the closure environment of the describe callback even after the test is done. From b24f8f35b762e6239454f4ab7431c2ab57086e43 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 12 Nov 2015 14:09:51 -0800 Subject: [PATCH 06/11] go go go --- tests/cases/compiler/commonSourceDir3.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/cases/compiler/commonSourceDir3.ts b/tests/cases/compiler/commonSourceDir3.ts index cc42eb8f267..54b6e8c89b7 100644 --- a/tests/cases/compiler/commonSourceDir3.ts +++ b/tests/cases/compiler/commonSourceDir3.ts @@ -1,3 +1,4 @@ +// @useCaseSensitiveFileNames: false // @outDir: A:/ // @Filename: A:/foo/bar.ts var x: number; From 5bcf8611210e5e988bb6317def16389a71b2074c Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 12 Nov 2015 15:58:11 -0800 Subject: [PATCH 07/11] use relative path from current directory --- src/compiler/program.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 3981d5a2421..28c51ce2f3a 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -947,7 +947,9 @@ namespace ts { return currentDirectory; } - return getNormalizedPathFromPathComponents(commonPathComponents); + const path = getNormalizedPathFromPathComponents(commonPathComponents); + const relativePath = convertToRelativePath(path, currentDirectory, getCanonicalFileName); + return relativePath; } function checkSourceFilesBelongToPath(sourceFiles: SourceFile[], rootDirectory: string): boolean { From ecd4435986be2e0e2ff9492ca524a2af7f2ebf02 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 12 Nov 2015 16:22:35 -0800 Subject: [PATCH 08/11] Go all the way back to the original solution --- src/compiler/program.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 3fb432d9668..1f0096e7f6e 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -910,7 +910,7 @@ namespace ts { return; } - const sourcePathComponents = getNormalizedPathComponents(getCanonicalFileName(sourceFile.fileName), currentDirectory); + const sourcePathComponents = getNormalizedPathComponents(sourceFile.fileName, currentDirectory); sourcePathComponents.pop(); // The base file name is not part of the common directory path if (!commonPathComponents) { @@ -919,8 +919,9 @@ namespace ts { return; } + const caseSensitive = host.useCaseSensitiveFileNames(); for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (commonPathComponents[i] !== sourcePathComponents[i]) { + if (caseSensitive ? commonPathComponents[i] !== sourcePathComponents[i] : commonPathComponents[i].toLocaleLowerCase() !== sourcePathComponents[i].toLocaleLowerCase()) { if (i === 0) { // Failed to find any common path component return true; @@ -947,9 +948,7 @@ namespace ts { return currentDirectory; } - const path = getNormalizedPathFromPathComponents(commonPathComponents); - const relativePath = convertToRelativePath(path, currentDirectory, getCanonicalFileName); - return relativePath; + return getNormalizedPathFromPathComponents(commonPathComponents); } function checkSourceFilesBelongToPath(sourceFiles: SourceFile[], rootDirectory: string): boolean { From ff95731507bcf831f7339d25f72c37cc6c12fdd4 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 13 Nov 2015 16:49:16 -0800 Subject: [PATCH 09/11] :S --- src/harness/compilerRunner.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 0785faccdf2..16616505c4e 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -50,9 +50,8 @@ class CompilerBaselineRunner extends RunnerBase { // Everything declared here should be cleared out in the "after" callback. let justName: string; - let tcSettings: Harness.TestCaseParser.CompilerSettings; - let lastUnit: Harness.TestCaseParser.TestUnitData; + let tcSettings: Harness.TestCaseParser.CompilerSettings; let result: Harness.Compiler.CompilerResult; let program: ts.Program; @@ -67,7 +66,7 @@ class CompilerBaselineRunner extends RunnerBase { const content = Harness.IO.readFile(fileName); const testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName); const units = testCaseContent.testUnitData; - harnessSettings = testCaseContent.settings; + const tcSettings = testCaseContent.settings; lastUnit = units[units.length - 1]; const rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/"; // We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test) @@ -90,7 +89,7 @@ class CompilerBaselineRunner extends RunnerBase { } const output = Harness.Compiler.HarnessCompiler.compileFiles( - toBeCompiled, otherFiles, harnessSettings, /* options */ undefined, /* currentDirectory */ undefined); + toBeCompiled, otherFiles, tcSettings, /* options */ undefined, /* currentDirectory */ undefined); options = output.options; result = output.result; @@ -101,7 +100,6 @@ class CompilerBaselineRunner extends RunnerBase { // Mocha holds onto the closure environment of the describe callback even after the test is done. // Therefore we have to clean out large objects after the test is done. justName = undefined; - harnessSettings = undefined; lastUnit = undefined; result = undefined; program = undefined; @@ -178,7 +176,7 @@ class CompilerBaselineRunner extends RunnerBase { const declFileCompilationResult = Harness.Compiler.HarnessCompiler.compileDeclarationFiles( - toBeCompiled, otherFiles, result, harnessSettings, options, /* currentDirectory */ undefined); + toBeCompiled, otherFiles, result, tcSettings, options, /* currentDirectory */ undefined); if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) { jsCode += "\r\n\r\n//// [DtsFileErrors]\r\n"; From bfdb2d0fc98a2966b3564dde62860f93d87f0dac Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 13 Nov 2015 16:57:17 -0800 Subject: [PATCH 10/11] and somehow all that caused was a lint error --- src/harness/compilerRunner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 16616505c4e..dbe22beabcf 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -66,7 +66,7 @@ class CompilerBaselineRunner extends RunnerBase { const content = Harness.IO.readFile(fileName); const testCaseContent = Harness.TestCaseParser.makeUnitsFromTest(content, fileName); const units = testCaseContent.testUnitData; - const tcSettings = testCaseContent.settings; + tcSettings = testCaseContent.settings; lastUnit = units[units.length - 1]; const rootDir = lastUnit.originalFilePath.indexOf("conformance") === -1 ? "tests/cases/compiler/" : lastUnit.originalFilePath.substring(0, lastUnit.originalFilePath.lastIndexOf("/")) + "/"; // We need to assemble the list of input files for the compiler and other related files on the 'filesystem' (ie in a multi-file test) From a989595044bf942cef77360e7225622f464e4a6b Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 17 Nov 2015 11:24:17 -0800 Subject: [PATCH 11/11] use getCanonicalFileName on path fragments as in other utility methods --- src/compiler/program.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 80f793cb50f..dc31dfb5213 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -919,9 +919,8 @@ namespace ts { return; } - const caseSensitive = host.useCaseSensitiveFileNames(); for (let i = 0, n = Math.min(commonPathComponents.length, sourcePathComponents.length); i < n; i++) { - if (caseSensitive ? commonPathComponents[i] !== sourcePathComponents[i] : commonPathComponents[i].toLocaleLowerCase() !== sourcePathComponents[i].toLocaleLowerCase()) { + if (getCanonicalFileName(commonPathComponents[i]) !== getCanonicalFileName(sourcePathComponents[i])) { if (i === 0) { // Failed to find any common path component return true;