mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-23 19:07:27 -06:00
Add error reporting for using --noImplicitUseStrict with --options.alwaysStrict
This commit is contained in:
parent
418a251237
commit
2920f82804
@ -1473,6 +1473,10 @@ namespace ts {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib"));
|
||||
}
|
||||
|
||||
if (options.noImplicitUseStrict && options.alwaysStrict) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"));
|
||||
}
|
||||
|
||||
const languageVersion = options.target || ScriptTarget.ES3;
|
||||
const outFile = options.outFile || options.out;
|
||||
|
||||
|
||||
22
tests/baselines/reference/alwaysStrictModule2.errors.txt
Normal file
22
tests/baselines/reference/alwaysStrictModule2.errors.txt
Normal file
@ -0,0 +1,22 @@
|
||||
tests/cases/compiler/a.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/b.ts(3,13): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
|
||||
module M {
|
||||
export function f() {
|
||||
var arguments = [];
|
||||
~~~~~~~~~
|
||||
!!! error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/b.ts (1 errors) ====
|
||||
module M {
|
||||
export function f2() {
|
||||
var arguments = [];
|
||||
~~~~~~~~~
|
||||
!!! error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
}
|
||||
34
tests/baselines/reference/alwaysStrictModule2.js
Normal file
34
tests/baselines/reference/alwaysStrictModule2.js
Normal file
@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/alwaysStrictModule2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
|
||||
module M {
|
||||
export function f() {
|
||||
var arguments = [];
|
||||
}
|
||||
}
|
||||
|
||||
//// [b.ts]
|
||||
module M {
|
||||
export function f2() {
|
||||
var arguments = [];
|
||||
}
|
||||
}
|
||||
|
||||
//// [out.js]
|
||||
"use strict";
|
||||
var M;
|
||||
(function (M) {
|
||||
function f() {
|
||||
var arguments = [];
|
||||
}
|
||||
M.f = f;
|
||||
})(M || (M = {}));
|
||||
"use strict";
|
||||
var M;
|
||||
(function (M) {
|
||||
function f2() {
|
||||
var arguments = [];
|
||||
}
|
||||
M.f2 = f2;
|
||||
})(M || (M = {}));
|
||||
@ -1,6 +1,8 @@
|
||||
error TS5053: Option 'noImplicitUseStrict' cannot be specified with option 'alwaysStrict'.
|
||||
tests/cases/compiler/alwaysStrictNoImplicitUseStrict.ts(4,13): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
|
||||
|
||||
!!! error TS5053: Option 'noImplicitUseStrict' cannot be specified with option 'alwaysStrict'.
|
||||
==== tests/cases/compiler/alwaysStrictNoImplicitUseStrict.ts (1 errors) ====
|
||||
|
||||
module M {
|
||||
|
||||
16
tests/cases/compiler/alwaysStrictModule2.ts
Normal file
16
tests/cases/compiler/alwaysStrictModule2.ts
Normal file
@ -0,0 +1,16 @@
|
||||
// @alwaysStrict: true
|
||||
// @outFile: out.js
|
||||
|
||||
// @fileName: a.ts
|
||||
module M {
|
||||
export function f() {
|
||||
var arguments = [];
|
||||
}
|
||||
}
|
||||
|
||||
// @fileName: b.ts
|
||||
module M {
|
||||
export function f2() {
|
||||
var arguments = [];
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user