Repository navigation
Fix issue #568 (no error for file self reference) - #748
Mohamed Hegazy (mhegazy) merged 11 commits into
Conversation
…bernak/TypeScript into selfReferencingFileError Conflicts: src/compiler/parser.ts
There was a problem hiding this comment.
what about different casing? use getCanonicalFileName to ensure you are getting a consistent name for the file depending on the underlying host's case sensitivity.
There was a problem hiding this comment.
can I just use toLocaleLowerCase() for each filename in the comparison? It looks like inside this function I don't have a reference to host so I can't call getCanonicalFileName and because we don't actually care what the casing is inside the comparison (just that they are using the same casing) getCanonicalFileName seems unnecessary.
|
Thanks Chris Bubernak (@chrisbubernak). I had a few comments on the change, also we will need you to submit a Contributor License Agreement (CLA) before accepting this pull request. Download the agreement (Microsoft Contribution License Agreement.docx), sign, scan, and email it back to [email protected]. For more information please check out CONTRIBUTING.md |
|
I'm actually a Microsoft employee and I sent mail to your team yesterday about this and it sounded like I could contribute without the agreement, if that's not the case just let me know and I'll get that filled out. |
|
Need to fix the failing tests |
|
thanks Chris Bubernak (@chrisbubernak), my bad. did not connect the two threads :) |
There was a problem hiding this comment.
Please use a number greater than the last number in the 1xxx range. We dn't want to reuse error numbers used by the V1 compiler. Thanks!
casing, put diagnostic message in correct order
There was a problem hiding this comment.
old compiler had this as error code 5006, can we keep the same error code
There was a problem hiding this comment.
I originally had it as a 5006 error but I was told to change it to put it in the 1000 range.
There was a problem hiding this comment.
1000 is fine. we have moved these around lately. so I would keep them all consistent. thanks.
|
thanks. LGTM. |
|
Sheetal Nandi (@sheetalkamat) any other comments? |
|
thanks. |
Fix issue #568 (no error for file self reference)
Fix issue #568 where no error is being displayed when a file tries to reference itself.
The compiler now shows the error message "A file cannot have a reference to itself." when a file tries to reference itself. I've included 3 unit tests for this fix. The first has a file that tries to reference itself and should fail with this error. The second tries to reference a file of the same name but a different base path and, while it won't fail with the same file reference error, it should fail with a file not found error. The third test is a permutation of the first and references the same file but with "./" appended to the front, after normalizing the file paths this should fail as it is a reference to the same file.