diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts
index ebe8aa16f60..e0b8099ef3c 100644
--- a/src/compiler/diagnosticInformationMap.generated.ts
+++ b/src/compiler/diagnosticInformationMap.generated.ts
@@ -5,8 +5,8 @@ module ts {
Unterminated_string_literal: { code: 1002, category: DiagnosticCategory.Error, key: "Unterminated string literal." },
Identifier_expected: { code: 1003, category: DiagnosticCategory.Error, key: "Identifier expected." },
_0_expected: { code: 1005, category: DiagnosticCategory.Error, key: "'{0}' expected." },
- Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
A_file_cannot_have_a_reference_to_itself: { code: 1006, category: DiagnosticCategory.Error, key: "A file cannot have a reference to itself." },
+ Trailing_comma_not_allowed: { code: 1009, category: DiagnosticCategory.Error, key: "Trailing comma not allowed." },
Asterisk_Slash_expected: { code: 1010, category: DiagnosticCategory.Error, key: "'*/' expected." },
Unexpected_token: { code: 1012, category: DiagnosticCategory.Error, key: "Unexpected token." },
Catch_clause_parameter_cannot_have_a_type_annotation: { code: 1013, category: DiagnosticCategory.Error, key: "Catch clause parameter cannot have a type annotation." },
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index 7a395b071e5..1b89d2242c7 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -10,15 +10,15 @@
"'{0}' expected.": {
"category": "Error",
"code": 1005
- },
- "Trailing comma not allowed.": {
- "category": "Error",
- "code": 1009
},
"A file cannot have a reference to itself.": {
"category": "Error",
"code": 1006
},
+ "Trailing comma not allowed.": {
+ "category": "Error",
+ "code": 1009
+ },
"'*/' expected.": {
"category": "Error",
"code": 1010
diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts
index 32db284c7bf..15a55046db9 100644
--- a/src/compiler/parser.ts
+++ b/src/compiler/parser.ts
@@ -3833,7 +3833,7 @@ module ts {
var referenceFilename = matchResult[3];
var basePath = getDirectoryPath(file.filename);
var referenceFullPath = normalizePath(combinePaths(basePath, referenceFilename));
- if (file.filename === referenceFullPath) {
+ if (file.filename.toLocaleLowerCase() === referenceFullPath.toLocaleLowerCase()) {
errorAtPos(start, length, Diagnostics.A_file_cannot_have_a_reference_to_itself);
}
else {
diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt
index 9bdeb723415..4a086fae46f 100644
--- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt
+++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/amd/visibilityOfTypeUsedAcrossModules2.errors.txt
@@ -1,12 +1,16 @@
+main.ts(1,1): error TS1006: A file cannot have a reference to itself.
main.ts(2,1): error TS6053: File 'nonExistingFile1.ts' not found.
main.ts(3,1): error TS6053: File 'nonExistingFile2.ts' not found.
-==== main.ts (2 errors) ====
+==== main.ts (3 errors) ====
///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1006: A file cannot have a reference to itself.
///
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6053: File 'nonExistingFile1.ts' not found.
///
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS6053: File 'nonExistingFile2.ts' not found.
\ No newline at end of file
+!!! error TS6053: File 'nonExistingFile2.ts' not found.
+
\ No newline at end of file
diff --git a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt
index 9bdeb723415..4a086fae46f 100644
--- a/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt
+++ b/tests/baselines/reference/project/visibilityOfTypeUsedAcrossModules2/node/visibilityOfTypeUsedAcrossModules2.errors.txt
@@ -1,12 +1,16 @@
+main.ts(1,1): error TS1006: A file cannot have a reference to itself.
main.ts(2,1): error TS6053: File 'nonExistingFile1.ts' not found.
main.ts(3,1): error TS6053: File 'nonExistingFile2.ts' not found.
-==== main.ts (2 errors) ====
+==== main.ts (3 errors) ====
///
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS1006: A file cannot have a reference to itself.
///
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS6053: File 'nonExistingFile1.ts' not found.
///
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-!!! error TS6053: File 'nonExistingFile2.ts' not found.
\ No newline at end of file
+!!! error TS6053: File 'nonExistingFile2.ts' not found.
+
\ No newline at end of file