Repository navigation
Fix #10758 Add compiler option to parse in strict mode #11473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Mohamed Hegazy (mhegazy)
merged 3 commits into
microsoft:master
from
slawomir:10758-always-strict
Oct 14, 2016
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| tests/cases/compiler/alwaysStrict.ts(3,9): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/alwaysStrict.ts (1 errors) ==== | ||
|
|
||
| function f() { | ||
| var arguments = []; | ||
| ~~~~~~~~~ | ||
| !!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| //// [alwaysStrict.ts] | ||
|
|
||
| function f() { | ||
| var arguments = []; | ||
| } | ||
|
|
||
| //// [alwaysStrict.js] | ||
| "use strict"; | ||
| function f() { | ||
| var arguments = []; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| //// [alwaysStrictAlreadyUseStrict.ts] | ||
| "use strict" | ||
| function f() { | ||
| var a = []; | ||
| } | ||
|
|
||
| //// [alwaysStrictAlreadyUseStrict.js] | ||
| "use strict"; | ||
| function f() { | ||
| var a = []; | ||
| } |
8 changes: 8 additions & 0 deletions
8
tests/baselines/reference/alwaysStrictAlreadyUseStrict.symbols
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| === tests/cases/compiler/alwaysStrictAlreadyUseStrict.ts === | ||
| "use strict" | ||
| function f() { | ||
| >f : Symbol(f, Decl(alwaysStrictAlreadyUseStrict.ts, 0, 12)) | ||
|
|
||
| var a = []; | ||
| >a : Symbol(a, Decl(alwaysStrictAlreadyUseStrict.ts, 2, 7)) | ||
| } |
11 changes: 11 additions & 0 deletions
11
tests/baselines/reference/alwaysStrictAlreadyUseStrict.types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| === tests/cases/compiler/alwaysStrictAlreadyUseStrict.ts === | ||
| "use strict" | ||
| >"use strict" : "use strict" | ||
|
|
||
| function f() { | ||
| >f : () => void | ||
|
|
||
| var a = []; | ||
| >a : any[] | ||
| >[] : undefined[] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| tests/cases/compiler/alwaysStrictES6.ts(3,9): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/alwaysStrictES6.ts (1 errors) ==== | ||
|
|
||
| function f() { | ||
| var arguments = []; | ||
| ~~~~~~~~~ | ||
| !!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| //// [alwaysStrictES6.ts] | ||
|
|
||
| function f() { | ||
| var arguments = []; | ||
| } | ||
|
|
||
| //// [alwaysStrictES6.js] | ||
| "use strict"; | ||
| function f() { | ||
| var arguments = []; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| tests/cases/compiler/alwaysStrictModule.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/alwaysStrictModule.ts (1 errors) ==== | ||
|
|
||
| module M { | ||
| export function f() { | ||
| var arguments = []; | ||
| ~~~~~~~~~ | ||
| !!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //// [alwaysStrictModule.ts] | ||
|
|
||
| module M { | ||
| export function f() { | ||
| var arguments = []; | ||
| } | ||
| } | ||
|
|
||
| //// [alwaysStrictModule.js] | ||
| "use strict"; | ||
| var M; | ||
| (function (M) { | ||
| function f() { | ||
| var arguments = []; | ||
| } | ||
| M.f = f; | ||
| })(M || (M = {})); |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/alwaysStrictNoImplicitUseStrict.errors.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| tests/cases/compiler/alwaysStrictNoImplicitUseStrict.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode. | ||
|
|
||
|
|
||
| ==== tests/cases/compiler/alwaysStrictNoImplicitUseStrict.ts (1 errors) ==== | ||
|
|
||
| module M { | ||
| export function f() { | ||
| var arguments = []; | ||
| ~~~~~~~~~ | ||
| !!! error TS1100: Invalid use of 'arguments' in strict mode. | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/alwaysStrictNoImplicitUseStrict.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| //// [alwaysStrictNoImplicitUseStrict.ts] | ||
|
|
||
| module M { | ||
| export function f() { | ||
| var arguments = []; | ||
| } | ||
| } | ||
|
|
||
| //// [alwaysStrictNoImplicitUseStrict.js] | ||
| "use strict"; | ||
| var M; | ||
| (function (M) { | ||
| function f() { | ||
| var arguments = []; | ||
| } | ||
| M.f = f; | ||
| })(M || (M = {})); | ||
3 changes: 3 additions & 0 deletions
3
tests/baselines/reference/transpile/Supports setting alwaysStrict.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // @alwaysStrict: true | ||
|
|
||
| function f() { | ||
| var arguments = []; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // @alwaysStrict: true | ||
| "use strict" | ||
| function f() { | ||
| var a = []; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // @target: ES6 | ||
| // @alwaysStrict: true | ||
|
|
||
| function f() { | ||
| var arguments = []; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| // @module: commonjs | ||
| // @alwaysStrict: true | ||
|
|
||
| module M { | ||
| export function f() { | ||
| var arguments = []; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // @module: commonjs | ||
| // @alwaysStrict: true | ||
| // @noImplicitUseStrict: true | ||
|
|
||
| module M { | ||
| export function f() { | ||
| var arguments = []; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alwaysStrict overrides noImplicitUseStrict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a check in program.ts::verifyCompilerOptions to flag teh use of
--noImplicitUseStrictand--alwaysStrictas invalid combination.. so somthing like