mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Merge branch 'master' into labelledStatements
Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json src/compiler/parser.ts
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;
|
||||
})();
|
||||
@@ -234,5 +234,5 @@
|
||||
interface B extends A { }
|
||||
var x: B = { };
|
||||
~
|
||||
!!! Type '{}' is not assignable to type 'B':
|
||||
!!! Property 'x' is missing in type '{}'.
|
||||
!!! Type '{}' is not assignable to type 'B':\n Property 'x' is missing in type '{}'.
|
||||
|
||||
@@ -228,198 +228,8 @@ Point.prototype = {
|
||||
|
||||
interface A { x: string; }
|
||||
interface B extends A { }
|
||||
var x: B = { };
|
||||
var x: B = { };
|
||||
|
||||
|
||||
//// [contextualTyping.js]
|
||||
var C1T5 = (function () {
|
||||
function C1T5() {
|
||||
this.foo = function (i) {
|
||||
return i;
|
||||
};
|
||||
}
|
||||
return C1T5;
|
||||
})();
|
||||
var C2T5;
|
||||
(function (C2T5) {
|
||||
C2T5.foo = function (i) {
|
||||
return i;
|
||||
};
|
||||
})(C2T5 || (C2T5 = {}));
|
||||
var c3t1 = (function (s) {
|
||||
return s;
|
||||
});
|
||||
var c3t2 = ({
|
||||
n: 1
|
||||
});
|
||||
var c3t3 = [];
|
||||
var c3t4 = function () {
|
||||
return ({});
|
||||
};
|
||||
var c3t5 = function (n) {
|
||||
return ({});
|
||||
};
|
||||
var c3t6 = function (n, s) {
|
||||
return ({});
|
||||
};
|
||||
var c3t7 = function (n) {
|
||||
return n;
|
||||
};
|
||||
var c3t8 = function (n) {
|
||||
return n;
|
||||
};
|
||||
var c3t9 = [[], []];
|
||||
var c3t10 = [({}), ({})];
|
||||
var c3t11 = [function (n, s) {
|
||||
return s;
|
||||
}];
|
||||
var c3t12 = {
|
||||
foo: ({})
|
||||
};
|
||||
var c3t13 = ({
|
||||
f: function (i, s) {
|
||||
return s;
|
||||
}
|
||||
});
|
||||
var c3t14 = ({
|
||||
a: []
|
||||
});
|
||||
var C4T5 = (function () {
|
||||
function C4T5() {
|
||||
this.foo = function (i, s) {
|
||||
return s;
|
||||
};
|
||||
}
|
||||
return C4T5;
|
||||
})();
|
||||
var C5T5;
|
||||
(function (C5T5) {
|
||||
C5T5.foo;
|
||||
C5T5.foo = function (i, s) {
|
||||
return s;
|
||||
};
|
||||
})(C5T5 || (C5T5 = {}));
|
||||
var c6t5;
|
||||
c6t5 = function (n) {
|
||||
return ({});
|
||||
};
|
||||
var c7t2;
|
||||
c7t2[0] = ({ n: 1 });
|
||||
var objc8 = ({});
|
||||
objc8.t1 = (function (s) {
|
||||
return s;
|
||||
});
|
||||
objc8.t2 = ({
|
||||
n: 1
|
||||
});
|
||||
objc8.t3 = [];
|
||||
objc8.t4 = function () {
|
||||
return ({});
|
||||
};
|
||||
objc8.t5 = function (n) {
|
||||
return ({});
|
||||
};
|
||||
objc8.t6 = function (n, s) {
|
||||
return ({});
|
||||
};
|
||||
objc8.t7 = function (n) {
|
||||
return n;
|
||||
};
|
||||
objc8.t8 = function (n) {
|
||||
return n;
|
||||
};
|
||||
objc8.t9 = [[], []];
|
||||
objc8.t10 = [({}), ({})];
|
||||
objc8.t11 = [function (n, s) {
|
||||
return s;
|
||||
}];
|
||||
objc8.t12 = {
|
||||
foo: ({})
|
||||
};
|
||||
objc8.t13 = ({
|
||||
f: function (i, s) {
|
||||
return s;
|
||||
}
|
||||
});
|
||||
objc8.t14 = ({
|
||||
a: []
|
||||
});
|
||||
function c9t5(f) {
|
||||
}
|
||||
;
|
||||
c9t5(function (n) {
|
||||
return ({});
|
||||
});
|
||||
var c10t5 = function () {
|
||||
return function (n) {
|
||||
return ({});
|
||||
};
|
||||
};
|
||||
var C11t5 = (function () {
|
||||
function C11t5(f) {
|
||||
}
|
||||
return C11t5;
|
||||
})();
|
||||
;
|
||||
var i = new C11t5(function (n) {
|
||||
return ({});
|
||||
});
|
||||
var c12t1 = (function (s) {
|
||||
return s;
|
||||
});
|
||||
var c12t2 = ({
|
||||
n: 1
|
||||
});
|
||||
var c12t3 = [];
|
||||
var c12t4 = function () {
|
||||
return ({});
|
||||
};
|
||||
var c12t5 = function (n) {
|
||||
return ({});
|
||||
};
|
||||
var c12t6 = function (n, s) {
|
||||
return ({});
|
||||
};
|
||||
var c12t7 = function (n) {
|
||||
return n;
|
||||
};
|
||||
var c12t8 = function (n) {
|
||||
return n;
|
||||
};
|
||||
var c12t9 = [[], []];
|
||||
var c12t10 = [({}), ({})];
|
||||
var c12t11 = [function (n, s) {
|
||||
return s;
|
||||
}];
|
||||
var c12t12 = {
|
||||
foo: ({})
|
||||
};
|
||||
var c12t13 = ({
|
||||
f: function (i, s) {
|
||||
return s;
|
||||
}
|
||||
});
|
||||
var c12t14 = ({
|
||||
a: []
|
||||
});
|
||||
function EF1(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
var efv = EF1(1, 2);
|
||||
function Point(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
return this;
|
||||
}
|
||||
Point.origin = new Point(0, 0);
|
||||
Point.prototype.add = function (dx, dy) {
|
||||
return new Point(this.x + dx, this.y + dy);
|
||||
};
|
||||
Point.prototype = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
add: function (dx, dy) {
|
||||
return new Point(this.x + dx, this.y + dy);
|
||||
}
|
||||
};
|
||||
var x = {};
|
||||
//# sourceMappingURL=contextualTyping.js.map
|
||||
var C1T5 = (function () {\n function C1T5() {\n this.foo = function (i) {\n return i;\n };\n }\n return C1T5;\n})();\nvar C2T5;\n(function (C2T5) {\n C2T5.foo = function (i) {\n return i;\n };\n})(C2T5 || (C2T5 = {}));\nvar c3t1 = (function (s) {\n return s;\n});\nvar c3t2 = ({\n n: 1\n});\nvar c3t3 = [];\nvar c3t4 = function () {\n return ({});\n};\nvar c3t5 = function (n) {\n return ({});\n};\nvar c3t6 = function (n, s) {\n return ({});\n};\nvar c3t7 = function (n) {\n return n;\n};\nvar c3t8 = function (n) {\n return n;\n};\nvar c3t9 = [[], []];\nvar c3t10 = [({}), ({})];\nvar c3t11 = [function (n, s) {\n return s;\n}];\nvar c3t12 = {\n foo: ({})\n};\nvar c3t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c3t14 = ({\n a: []\n});\nvar C4T5 = (function () {\n function C4T5() {\n this.foo = function (i, s) {\n return s;\n };\n }\n return C4T5;\n})();\nvar C5T5;\n(function (C5T5) {\n C5T5.foo;\n C5T5.foo = function (i, s) {\n return s;\n };\n})(C5T5 || (C5T5 = {}));\nvar c6t5;\nc6t5 = function (n) {\n return ({});\n};\nvar c7t2;\nc7t2[0] = ({ n: 1 });\nvar objc8 = ({});\nobjc8.t1 = (function (s) {\n return s;\n});\nobjc8.t2 = ({\n n: 1\n});\nobjc8.t3 = [];\nobjc8.t4 = function () {\n return ({});\n};\nobjc8.t5 = function (n) {\n return ({});\n};\nobjc8.t6 = function (n, s) {\n return ({});\n};\nobjc8.t7 = function (n) {\n return n;\n};\nobjc8.t8 = function (n) {\n return n;\n};\nobjc8.t9 = [[], []];\nobjc8.t10 = [({}), ({})];\nobjc8.t11 = [function (n, s) {\n return s;\n}];\nobjc8.t12 = {\n foo: ({})\n};\nobjc8.t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nobjc8.t14 = ({\n a: []\n});\nfunction c9t5(f) {\n}\n;\nc9t5(function (n) {\n return ({});\n});\nvar c10t5 = function () {\n return function (n) {\n return ({});\n };\n};\nvar C11t5 = (function () {\n function C11t5(f) {\n }\n return C11t5;\n})();\n;\nvar i = new C11t5(function (n) {\n return ({});\n});\nvar c12t1 = (function (s) {\n return s;\n});\nvar c12t2 = ({\n n: 1\n});\nvar c12t3 = [];\nvar c12t4 = function () {\n return ({});\n};\nvar c12t5 = function (n) {\n return ({});\n};\nvar c12t6 = function (n, s) {\n return ({});\n};\nvar c12t7 = function (n) {\n return n;\n};\nvar c12t8 = function (n) {\n return n;\n};\nvar c12t9 = [[], []];\nvar c12t10 = [({}), ({})];\nvar c12t11 = [function (n, s) {\n return s;\n}];\nvar c12t12 = {\n foo: ({})\n};\nvar c12t13 = ({\n f: function (i, s) {\n return s;\n }\n});\nvar c12t14 = ({\n a: []\n});\nfunction EF1(a, b) {\n return a + b;\n}\nvar efv = EF1(1, 2);\nfunction Point(x, y) {\n this.x = x;\n this.y = y;\n return this;\n}\nPoint.origin = new Point(0, 0);\nPoint.prototype.add = function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n};\nPoint.prototype = {\n x: 0,\n y: 0,\n add: function (dx, dy) {\n return new Point(this.x + dx, this.y + dy);\n }\n};\nvar x = {};\n//# sourceMappingURL=contextualTyping.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (8 errors) ====
|
||||
==== tests/cases/compiler/duplicateObjectLiteralProperty.ts (9 errors) ====
|
||||
var x = {
|
||||
a: 1,
|
||||
b: true, // OK
|
||||
@@ -30,6 +30,8 @@
|
||||
~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~
|
||||
!!! An object literal cannot have multiple get/set accessors with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
};
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
==== tests/cases/compiler/duplicatePropertiesInStrictMode.ts (2 errors) ====
|
||||
"use strict";
|
||||
var x = {
|
||||
x: 1,
|
||||
x: 2
|
||||
~
|
||||
!!! An object literal cannot have multiple properties with the same name in strict mode.
|
||||
~
|
||||
!!! Duplicate identifier 'x'.
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (41 errors) ====
|
||||
==== tests/cases/conformance/expressions/objectLiterals/objectLiteralErrors.ts (59 errors) ====
|
||||
|
||||
// Multiple properties with the same name
|
||||
var e1 = { a: 0, a: 0 };
|
||||
@@ -59,57 +59,93 @@
|
||||
// Accessor and property with the same name
|
||||
var f1 = { a: 0, get a() { return 0; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
var f2 = { a: '', get a() { return ''; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
var f3 = { a: 0, get a() { return ''; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
var f4 = { a: true, get a() { return false; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
var f5 = { a: {}, get a() { return {}; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
var f6 = { a: 0, get 'a'() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier ''a''.
|
||||
var f7 = { 'a': 0, get a() { return 0; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
var f8 = { 'a': 0, get "a"() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier '"a"'.
|
||||
var f9 = { 'a': 0, get 'a'() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier ''a''.
|
||||
var f10 = { "a": 0, get 'a'() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier ''a''.
|
||||
var f11 = { 1.0: 0, get '1'() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier ''1''.
|
||||
var f12 = { 0: 0, get 0() { return 0; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier '0'.
|
||||
var f13 = { 0: 0, get 0() { return 0; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier '0'.
|
||||
var f14 = { 0: 0, get 0x0() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier '0x0'.
|
||||
var f14 = { 0: 0, get 000() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier '000'.
|
||||
var f15 = { "100": 0, get 1e2() { return 0; } };
|
||||
~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~
|
||||
!!! Duplicate identifier '1e2'.
|
||||
var f16 = { 0x20: 0, get 3.2e1() { return 0; } };
|
||||
~~~~~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~~~~~
|
||||
!!! Duplicate identifier '3.2e1'.
|
||||
var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } };
|
||||
~
|
||||
!!! An object literal cannot have property and accessor with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'a'.
|
||||
|
||||
// Get and set accessor with mismatched type annotations
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
//// [objectLiteralErrors.ts]
|
||||
|
||||
// Multiple properties with the same name
|
||||
var e1 = { a: 0, a: 0 };
|
||||
var e2 = { a: '', a: '' };
|
||||
var e3 = { a: 0, a: '' };
|
||||
var e4 = { a: true, a: false };
|
||||
var e5 = { a: {}, a: {} };
|
||||
var e6 = { a: 0, 'a': 0 };
|
||||
var e7 = { 'a': 0, a: 0 };
|
||||
var e8 = { 'a': 0, "a": 0 };
|
||||
var e9 = { 'a': 0, 'a': 0 };
|
||||
var e10 = { "a": 0, 'a': 0 };
|
||||
var e11 = { 1.0: 0, '1': 0 };
|
||||
var e12 = { 0: 0, 0: 0 };
|
||||
var e13 = { 0: 0, 0: 0 };
|
||||
var e14 = { 0: 0, 0x0: 0 };
|
||||
var e14 = { 0: 0, 000: 0 };
|
||||
var e15 = { "100": 0, 1e2: 0 };
|
||||
var e16 = { 0x20: 0, 3.2e1: 0 };
|
||||
var e17 = { a: 0, b: 1, a: 0 };
|
||||
|
||||
// Accessor and property with the same name
|
||||
var f1 = { a: 0, get a() { return 0; } };
|
||||
var f2 = { a: '', get a() { return ''; } };
|
||||
var f3 = { a: 0, get a() { return ''; } };
|
||||
var f4 = { a: true, get a() { return false; } };
|
||||
var f5 = { a: {}, get a() { return {}; } };
|
||||
var f6 = { a: 0, get 'a'() { return 0; } };
|
||||
var f7 = { 'a': 0, get a() { return 0; } };
|
||||
var f8 = { 'a': 0, get "a"() { return 0; } };
|
||||
var f9 = { 'a': 0, get 'a'() { return 0; } };
|
||||
var f10 = { "a": 0, get 'a'() { return 0; } };
|
||||
var f11 = { 1.0: 0, get '1'() { return 0; } };
|
||||
var f12 = { 0: 0, get 0() { return 0; } };
|
||||
var f13 = { 0: 0, get 0() { return 0; } };
|
||||
var f14 = { 0: 0, get 0x0() { return 0; } };
|
||||
var f14 = { 0: 0, get 000() { return 0; } };
|
||||
var f15 = { "100": 0, get 1e2() { return 0; } };
|
||||
var f16 = { 0x20: 0, get 3.2e1() { return 0; } };
|
||||
var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } };
|
||||
|
||||
// Get and set accessor with mismatched type annotations
|
||||
var g1 = { get a(): number { return 4; }, set a(n: string) { } };
|
||||
var g2 = { get a() { return 4; }, set a(n: string) { } };
|
||||
var g3 = { get a(): number { return undefined; }, set a(n: string) { } };
|
||||
|
||||
|
||||
//// [objectLiteralErrors.js]
|
||||
var e1 = { a: 0, a: 0 };
|
||||
var e2 = { a: '', a: '' };
|
||||
var e3 = { a: 0, a: '' };
|
||||
var e4 = { a: true, a: false };
|
||||
var e5 = { a: {}, a: {} };
|
||||
var e6 = { a: 0, 'a': 0 };
|
||||
var e7 = { 'a': 0, a: 0 };
|
||||
var e8 = { 'a': 0, "a": 0 };
|
||||
var e9 = { 'a': 0, 'a': 0 };
|
||||
var e10 = { "a": 0, 'a': 0 };
|
||||
var e11 = { 1.0: 0, '1': 0 };
|
||||
var e12 = { 0: 0, 0: 0 };
|
||||
var e13 = { 0: 0, 0: 0 };
|
||||
var e14 = { 0: 0, 0x0: 0 };
|
||||
var e14 = { 0: 0, 000: 0 };
|
||||
var e15 = { "100": 0, 1e2: 0 };
|
||||
var e16 = { 0x20: 0, 3.2e1: 0 };
|
||||
var e17 = { a: 0, b: 1, a: 0 };
|
||||
var f1 = { a: 0, get a() {
|
||||
return 0;
|
||||
} };
|
||||
var f2 = { a: '', get a() {
|
||||
return '';
|
||||
} };
|
||||
var f3 = { a: 0, get a() {
|
||||
return '';
|
||||
} };
|
||||
var f4 = { a: true, get a() {
|
||||
return false;
|
||||
} };
|
||||
var f5 = { a: {}, get a() {
|
||||
return {};
|
||||
} };
|
||||
var f6 = { a: 0, get 'a'() {
|
||||
return 0;
|
||||
} };
|
||||
var f7 = { 'a': 0, get a() {
|
||||
return 0;
|
||||
} };
|
||||
var f8 = { 'a': 0, get "a"() {
|
||||
return 0;
|
||||
} };
|
||||
var f9 = { 'a': 0, get 'a'() {
|
||||
return 0;
|
||||
} };
|
||||
var f10 = { "a": 0, get 'a'() {
|
||||
return 0;
|
||||
} };
|
||||
var f11 = { 1.0: 0, get '1'() {
|
||||
return 0;
|
||||
} };
|
||||
var f12 = { 0: 0, get 0() {
|
||||
return 0;
|
||||
} };
|
||||
var f13 = { 0: 0, get 0() {
|
||||
return 0;
|
||||
} };
|
||||
var f14 = { 0: 0, get 0x0() {
|
||||
return 0;
|
||||
} };
|
||||
var f14 = { 0: 0, get 000() {
|
||||
return 0;
|
||||
} };
|
||||
var f15 = { "100": 0, get 1e2() {
|
||||
return 0;
|
||||
} };
|
||||
var f16 = { 0x20: 0, get 3.2e1() {
|
||||
return 0;
|
||||
} };
|
||||
var f17 = { a: 0, get b() {
|
||||
return 1;
|
||||
}, get a() {
|
||||
return 0;
|
||||
} };
|
||||
var g1 = { get a() {
|
||||
return 4;
|
||||
}, set a(n) {
|
||||
} };
|
||||
var g2 = { get a() {
|
||||
return 4;
|
||||
}, set a(n) {
|
||||
} };
|
||||
var g3 = { get a() {
|
||||
return undefined;
|
||||
}, set a(n) {
|
||||
} };
|
||||
@@ -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,8 @@
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode14.ts (2 errors) ====
|
||||
==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode14.ts (3 errors) ====
|
||||
"use strict";
|
||||
with (a) {
|
||||
~~~~
|
||||
!!! 'with' statements are not allowed in strict mode.
|
||||
~
|
||||
!!! All symbols within a 'with' block will be resolved to 'any'.
|
||||
~
|
||||
|
||||
@@ -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;
|
||||
@@ -1,4 +1,4 @@
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts (13 errors) ====
|
||||
==== tests/cases/conformance/classes/propertyMemberDeclarations/twoAccessorsWithSameName.ts (14 errors) ====
|
||||
class C {
|
||||
get x() { return 1; }
|
||||
~
|
||||
@@ -44,6 +44,8 @@
|
||||
~
|
||||
!!! Accessors are only available when targeting ECMAScript 5 and higher.
|
||||
~
|
||||
!!! An object literal cannot have multiple get/set accessors with the same name.
|
||||
~
|
||||
!!! Duplicate identifier 'x'.
|
||||
return 1;
|
||||
}
|
||||
|
||||
29
tests/baselines/reference/typeQueryWithReservedWords.js
Normal file
29
tests/baselines/reference/typeQueryWithReservedWords.js
Normal file
@@ -0,0 +1,29 @@
|
||||
//// [typeQueryWithReservedWords.ts]
|
||||
class Controller {
|
||||
create() {
|
||||
}
|
||||
delete() {
|
||||
}
|
||||
var() {
|
||||
}
|
||||
}
|
||||
|
||||
interface IScope {
|
||||
create: typeof Controller.prototype.create;
|
||||
delete: typeof Controller.prototype.delete; // Should not error
|
||||
var: typeof Controller.prototype.var; // Should not error
|
||||
}
|
||||
|
||||
|
||||
//// [typeQueryWithReservedWords.js]
|
||||
var Controller = (function () {
|
||||
function Controller() {
|
||||
}
|
||||
Controller.prototype.create = function () {
|
||||
};
|
||||
Controller.prototype.delete = function () {
|
||||
};
|
||||
Controller.prototype.var = function () {
|
||||
};
|
||||
return Controller;
|
||||
})();
|
||||
@@ -1,3 +1,4 @@
|
||||
// @newline: \n
|
||||
// @sourcemap: true
|
||||
// DEFAULT INTERFACES
|
||||
interface IFoo {
|
||||
@@ -228,4 +229,4 @@ Point.prototype = {
|
||||
|
||||
interface A { x: string; }
|
||||
interface B extends A { }
|
||||
var x: B = { };
|
||||
var x: B = { };
|
||||
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class Controller {
|
||||
create() {
|
||||
}
|
||||
delete() {
|
||||
}
|
||||
var() {
|
||||
}
|
||||
}
|
||||
|
||||
interface IScope {
|
||||
create: typeof Controller.prototype.create;
|
||||
delete: typeof Controller.prototype.delete; // Should not error
|
||||
var: typeof Controller.prototype.var; // Should not error
|
||||
}
|
||||
Reference in New Issue
Block a user