mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
enabled strict mode
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
==== tests/cases/compiler/constructorStaticParamNameErrors.ts (1 errors) ====
|
||||
'use strict'
|
||||
// static as constructor parameter name should give error if 'use strict'
|
||||
class test {
|
||||
constructor (static) { }
|
||||
~~~~~~
|
||||
!!! Identifier expected.
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
//// [constructorStaticParamNameErrors.ts]
|
||||
'use strict'
|
||||
// static as constructor parameter name should give error if 'use strict'
|
||||
class test {
|
||||
constructor (static) { }
|
||||
}
|
||||
|
||||
//// [constructorStaticParamNameErrors.js]
|
||||
'use strict';
|
||||
var test = (function () {
|
||||
function test(static) {
|
||||
}
|
||||
return test;
|
||||
})();
|
||||
@@ -0,0 +1,10 @@
|
||||
==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (2 errors) ====
|
||||
"use strict";
|
||||
var x = {
|
||||
x: 1,
|
||||
x: 2
|
||||
~
|
||||
!!! Object literal cannot contain more than one property with the same name in the strict mode.
|
||||
~
|
||||
!!! Duplicate identifier 'x'.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/parser10.1.1-8gs.ts (4 errors) ====
|
||||
/// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
/// Ecma International makes this code available under the terms and conditions set
|
||||
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
|
||||
@@ -18,4 +18,10 @@
|
||||
~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'NotEarlyError'.
|
||||
var public = 1;
|
||||
~~~~~~
|
||||
!!! Variable declaration expected.
|
||||
~
|
||||
!!! Variable declaration expected.
|
||||
~
|
||||
!!! Variable declaration expected.
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
//// [parser10.1.1-8gs.ts]
|
||||
/// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
/// Ecma International makes this code available under the terms and conditions set
|
||||
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
|
||||
/// "Use Terms"). Any redistribution of this code must retain the above
|
||||
/// copyright and this notice and otherwise comply with the Use Terms.
|
||||
|
||||
/**
|
||||
* @path ch10/10.1/10.1.1/10.1.1-8gs.js
|
||||
* @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code
|
||||
* @noStrict
|
||||
* @negative ^((?!NotEarlyError).)*$
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
throw NotEarlyError;
|
||||
var public = 1;
|
||||
|
||||
|
||||
//// [parser10.1.1-8gs.js]
|
||||
"use strict";
|
||||
"use strict";
|
||||
throw NotEarlyError;
|
||||
var public = 1;
|
||||
9
tests/baselines/reference/parser642331_1.errors.txt
Normal file
9
tests/baselines/reference/parser642331_1.errors.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser642331_1.ts (1 errors) ====
|
||||
"use strict";
|
||||
|
||||
class test {
|
||||
constructor (static) { }
|
||||
~~~~~~
|
||||
!!! Identifier expected.
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
//// [parser642331_1.ts]
|
||||
"use strict";
|
||||
|
||||
class test {
|
||||
constructor (static) { }
|
||||
}
|
||||
|
||||
|
||||
//// [parser642331_1.js]
|
||||
"use strict";
|
||||
var test = (function () {
|
||||
function test(static) {
|
||||
}
|
||||
return test;
|
||||
})();
|
||||
6
tests/baselines/reference/parserStrictMode10.errors.txt
Normal file
6
tests/baselines/reference/parserStrictMode10.errors.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode10.ts (1 errors) ====
|
||||
"use strict";
|
||||
function f(eval) {
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [parserStrictMode10.ts]
|
||||
"use strict";
|
||||
function f(eval) {
|
||||
}
|
||||
|
||||
//// [parserStrictMode10.js]
|
||||
"use strict";
|
||||
function f(eval) {
|
||||
}
|
||||
6
tests/baselines/reference/parserStrictMode11.errors.txt
Normal file
6
tests/baselines/reference/parserStrictMode11.errors.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode11.ts (1 errors) ====
|
||||
"use strict";
|
||||
var v = function f(eval) {
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [parserStrictMode11.ts]
|
||||
"use strict";
|
||||
var v = function f(eval) {
|
||||
};
|
||||
|
||||
//// [parserStrictMode11.js]
|
||||
"use strict";
|
||||
var v = function f(eval) {
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode12.ts (1 errors) ====
|
||||
"use strict";
|
||||
var v = { set foo(eval) { } }
|
||||
~~~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
8
tests/baselines/reference/parserStrictMode13.errors.txt
Normal file
8
tests/baselines/reference/parserStrictMode13.errors.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode13.ts (1 errors) ====
|
||||
"use strict";
|
||||
try {
|
||||
}
|
||||
catch(eval) {
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [parserStrictMode13.ts]
|
||||
"use strict";
|
||||
try {
|
||||
}
|
||||
catch(eval) {
|
||||
}
|
||||
|
||||
//// [parserStrictMode13.js]
|
||||
"use strict";
|
||||
try {
|
||||
}
|
||||
catch (eval) {
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode14.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode14.ts (2 errors) ====
|
||||
"use strict";
|
||||
with (a) {
|
||||
~~~~~~~~~~
|
||||
~
|
||||
!!! Cannot find name 'a'.
|
||||
}
|
||||
}
|
||||
~
|
||||
!!! 'with' statements are not allowed in strict mode.
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [parserStrictMode14.ts]
|
||||
"use strict";
|
||||
with (a) {
|
||||
}
|
||||
|
||||
//// [parserStrictMode14.js]
|
||||
"use strict";
|
||||
with (a) {
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts (4 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode2.ts (5 errors) ====
|
||||
"use strict";
|
||||
foo1();
|
||||
~~~~
|
||||
@@ -11,4 +11,6 @@
|
||||
!!! Cannot find name 'foo1'.
|
||||
static();
|
||||
~~~~~~
|
||||
!!! Cannot find name 'static'.
|
||||
!!! Declaration or statement expected.
|
||||
~
|
||||
!!! '=>' expected.
|
||||
@@ -1,13 +0,0 @@
|
||||
//// [parserStrictMode2.ts]
|
||||
"use strict";
|
||||
foo1();
|
||||
foo1();
|
||||
foo1();
|
||||
static();
|
||||
|
||||
//// [parserStrictMode2.js]
|
||||
"use strict";
|
||||
foo1();
|
||||
foo1();
|
||||
foo1();
|
||||
static();
|
||||
@@ -1,5 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode3.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode3.ts (2 errors) ====
|
||||
"use strict";
|
||||
eval = 1;
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
~~~~
|
||||
!!! Invalid left-hand side of assignment expression.
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [parserStrictMode3.ts]
|
||||
"use strict";
|
||||
eval = 1;
|
||||
|
||||
//// [parserStrictMode3.js]
|
||||
"use strict";
|
||||
eval = 1;
|
||||
@@ -1,5 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode4.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode4.ts (2 errors) ====
|
||||
"use strict";
|
||||
arguments = 1;
|
||||
~~~~~~~~~
|
||||
!!! Invalid use of 'arguments' in strict mode.
|
||||
~~~~~~~~~
|
||||
!!! Cannot find name 'arguments'.
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [parserStrictMode4.ts]
|
||||
"use strict";
|
||||
arguments = 1;
|
||||
|
||||
//// [parserStrictMode4.js]
|
||||
"use strict";
|
||||
arguments = 1;
|
||||
@@ -1,5 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode5.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode5.ts (2 errors) ====
|
||||
"use strict";
|
||||
eval += 1;
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
~~~~~~~~~
|
||||
!!! Operator '+=' cannot be applied to types '(x: string) => any' and 'number'.
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [parserStrictMode5.ts]
|
||||
"use strict";
|
||||
eval += 1;
|
||||
|
||||
//// [parserStrictMode5.js]
|
||||
"use strict";
|
||||
eval += 1;
|
||||
@@ -1,5 +1,7 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode6.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode6.ts (2 errors) ====
|
||||
"use strict";
|
||||
eval++;
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
~~~~
|
||||
!!! An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
@@ -1,7 +0,0 @@
|
||||
//// [parserStrictMode6.ts]
|
||||
"use strict";
|
||||
eval++;
|
||||
|
||||
//// [parserStrictMode6.js]
|
||||
"use strict";
|
||||
eval++;
|
||||
@@ -1,6 +1,8 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode8.ts (1 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode8.ts (2 errors) ====
|
||||
"use strict";
|
||||
function eval() {
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
~~~~
|
||||
!!! Overload signatures must all be ambient or non-ambient.
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [parserStrictMode8.ts]
|
||||
"use strict";
|
||||
function eval() {
|
||||
}
|
||||
|
||||
//// [parserStrictMode8.js]
|
||||
"use strict";
|
||||
function eval() {
|
||||
}
|
||||
6
tests/baselines/reference/parserStrictMode9.errors.txt
Normal file
6
tests/baselines/reference/parserStrictMode9.errors.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode9.ts (1 errors) ====
|
||||
"use strict";
|
||||
var v = function eval() {
|
||||
~~~~
|
||||
!!! Invalid use of 'eval' in strict mode.
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
//// [parserStrictMode9.ts]
|
||||
"use strict";
|
||||
var v = function eval() {
|
||||
};
|
||||
|
||||
//// [parserStrictMode9.js]
|
||||
"use strict";
|
||||
var v = function eval() {
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (1 errors) ====
|
||||
==== tests/cases/conformance/scanner/ecmascript5/scanner10.1.1-8gs.ts (4 errors) ====
|
||||
/// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
/// Ecma International makes this code available under the terms and conditions set
|
||||
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
|
||||
@@ -18,4 +18,10 @@
|
||||
~~~~~~~~~~~~~
|
||||
!!! Cannot find name 'NotEarlyError'.
|
||||
var public = 1;
|
||||
~~~~~~
|
||||
!!! Variable declaration expected.
|
||||
~
|
||||
!!! Variable declaration expected.
|
||||
~
|
||||
!!! Variable declaration expected.
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
//// [scanner10.1.1-8gs.ts]
|
||||
/// Copyright (c) 2012 Ecma International. All rights reserved.
|
||||
/// Ecma International makes this code available under the terms and conditions set
|
||||
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
|
||||
/// "Use Terms"). Any redistribution of this code must retain the above
|
||||
/// copyright and this notice and otherwise comply with the Use Terms.
|
||||
|
||||
/**
|
||||
* @path ch10/10.1/10.1.1/10.1.1-8gs.js
|
||||
* @description Strict Mode - Use Strict Directive Prologue is ''use strict';' which appears twice in the code
|
||||
* @noStrict
|
||||
* @negative ^((?!NotEarlyError).)*$
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
throw NotEarlyError;
|
||||
var public = 1;
|
||||
|
||||
|
||||
//// [scanner10.1.1-8gs.js]
|
||||
"use strict";
|
||||
"use strict";
|
||||
throw NotEarlyError;
|
||||
var public = 1;
|
||||
5
tests/cases/compiler/duplicatePropertiesInStrictMode.ts
Normal file
5
tests/cases/compiler/duplicatePropertiesInStrictMode.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
var x = {
|
||||
x: 1,
|
||||
x: 2
|
||||
}
|
||||
Reference in New Issue
Block a user