diff --git a/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt new file mode 100644 index 00000000000..60e786cbad1 --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es2017_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(7,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts (2 errors) ==== + + async function bar() { + !await 42; // OK + } + + async function bar1() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } + + async function bar4() { + +await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt new file mode 100644 index 00000000000..1c1072fd86c --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es2017_2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(3,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts (2 errors) ==== + + async function bar1() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt new file mode 100644 index 00000000000..90bd23b7597 --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es6_1.errors.txt @@ -0,0 +1,29 @@ +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(7,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts (2 errors) ==== + + async function bar() { + !await 42; // OK + } + + async function bar1() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; // OK + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } + + async function bar4() { + +await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt new file mode 100644 index 00000000000..9386d206eee --- /dev/null +++ b/tests/baselines/reference/await_unaryExpression_es6_2.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(3,12): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts (2 errors) ==== + + async function bar1() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar2() { + delete await 42; + ~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + } + + async function bar3() { + void await 42; + } \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt index 73ddab1a33c..d92f1ffb1e7 100644 --- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt +++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt @@ -1,9 +1,23 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(45,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(46,33): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,32): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(47,33): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,46): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (3 errors) ==== +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts (17 errors) ==== // delete operator on any type var ANY: any; @@ -31,13 +45,21 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean1 = delete ANY1; var ResultIsBoolean2 = delete ANY2; var ResultIsBoolean3 = delete A; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean4 = delete M; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean5 = delete obj; var ResultIsBoolean6 = delete obj1; // any type literal var ResultIsBoolean7 = delete undefined; + ~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean8 = delete null; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // any type expressions var ResultIsBoolean9 = delete ANY2[0]; @@ -46,21 +68,41 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator var ResultIsBoolean12 = delete objA.a; var ResultIsBoolean13 = delete M.n; var ResultIsBoolean14 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean15 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean16 = delete (ANY + ANY1); + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean17 = delete (null + undefined); + ~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. var ResultIsBoolean18 = delete (null + null); + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'. var ResultIsBoolean19 = delete (undefined + undefined); + ~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference ~~~~~~~~~~~~~~~~~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'. // multiple delete operators var ResultIsBoolean20 = delete delete ANY; + ~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference var ResultIsBoolean21 = delete delete delete (ANY + ANY1); + ~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference // miss assignment operators delete ANY; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt new file mode 100644 index 00000000000..3f653671e2e --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt @@ -0,0 +1,65 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (8 errors) ==== + // delete operator on boolean type + var BOOLEAN: boolean; + + function foo(): boolean { return true; } + + class A { + public a: boolean; + static foo() { return false; } + } + module M { + export var n: boolean; + } + + var objA = new A(); + + // boolean type var + var ResultIsBoolean1 = delete BOOLEAN; + + // boolean type literal + var ResultIsBoolean2 = delete true; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean3 = delete { x: true, y: false }; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // boolean type expressions + var ResultIsBoolean4 = delete objA.a; + var ResultIsBoolean5 = delete M.n; + var ResultIsBoolean6 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean7 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean8 = delete delete BOOLEAN; + ~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete true; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete BOOLEAN; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete true, false; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a; + delete M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt new file mode 100644 index 00000000000..103070d15dc --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt @@ -0,0 +1,64 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,45): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(22,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts (13 errors) ==== + // delete operator on enum type + + enum ENUM { }; + enum ENUM1 { A, B, "" }; + + // enum type var + var ResultIsBoolean1 = delete ENUM; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean2 = delete ENUM1; + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // enum type expressions + var ResultIsBoolean3 = delete ENUM1["A"]; + ~~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]); + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operators + var ResultIsBoolean5 = delete delete ENUM; + ~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete ENUM; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete ENUM1; + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete ENUM1.B; + ~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + delete ENUM, ENUM1; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt new file mode 100644 index 00000000000..bb35f3338b9 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt @@ -0,0 +1,84 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (12 errors) ==== + // delete operator on number type + var NUMBER: number; + var NUMBER1: number[] = [1, 2]; + + function foo(): number { return 1; } + + class A { + public a: number; + static foo() { return 1; } + } + module M { + export var n: number; + } + + var objA = new A(); + + // number type var + var ResultIsBoolean1 = delete NUMBER; + var ResultIsBoolean2 = delete NUMBER1; + + // number type literal + var ResultIsBoolean3 = delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean4 = delete { x: 1, y: 2}; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // number type expressions + var ResultIsBoolean6 = delete objA.a; + var ResultIsBoolean7 = delete M.n; + var ResultIsBoolean8 = delete NUMBER1[0]; + var ResultIsBoolean9 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean10 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean11 = delete (NUMBER + NUMBER); + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean12 = delete delete NUMBER; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete NUMBER; + delete NUMBER1; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a; + delete M.n; + delete objA.a, M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteOperatorWithStringType.errors.txt b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt new file mode 100644 index 00000000000..9ffde0a8f97 --- /dev/null +++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt @@ -0,0 +1,86 @@ +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,46): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (13 errors) ==== + // delete operator on string type + var STRING: string; + var STRING1: string[] = ["", "abc"]; + + function foo(): string { return "abc"; } + + class A { + public a: string; + static foo() { return ""; } + } + module M { + export var n: string; + } + + var objA = new A(); + + // string type var + var ResultIsBoolean1 = delete STRING; + var ResultIsBoolean2 = delete STRING1; + + // string type literal + var ResultIsBoolean3 = delete ""; + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean4 = delete { x: "", y: "" }; + ~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // string type expressions + var ResultIsBoolean6 = delete objA.a; + var ResultIsBoolean7 = delete M.n; + var ResultIsBoolean8 = delete STRING1[0]; + var ResultIsBoolean9 = delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean10 = delete A.foo(); + ~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean11 = delete (STRING + STRING); + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean12 = delete STRING.charAt(0); + ~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // multiple delete operator + var ResultIsBoolean13 = delete delete STRING; + ~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + var ResultIsBoolean14 = delete delete delete (STRING + STRING); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + ~~~~~~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + + // miss assignment operators + delete ""; + ~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete STRING; + delete STRING1; + delete foo(); + ~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete objA.a,M.n; \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.errors.txt b/tests/baselines/reference/deleteReadonly.errors.txt new file mode 100644 index 00000000000..c0fc3ee7dc3 --- /dev/null +++ b/tests/baselines/reference/deleteReadonly.errors.txt @@ -0,0 +1,28 @@ +tests/cases/compiler/deleteReadonly.ts(8,8): error TS2699: The operand of a delete operator cannot be a read-only property +tests/cases/compiler/deleteReadonly.ts(18,8): error TS2699: The operand of a delete operator cannot be a read-only property + + +==== tests/cases/compiler/deleteReadonly.ts (2 errors) ==== + interface A { + readonly b + } + var a: A = { + b: 123 + }; + + delete a.b; + ~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + + interface B { + readonly [k: string]: string + } + + var b: B = { + 'test': 'test' + }; + + delete b['test']; + ~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property + \ No newline at end of file diff --git a/tests/baselines/reference/deleteReadonly.js b/tests/baselines/reference/deleteReadonly.js new file mode 100644 index 00000000000..fd16bf270f6 --- /dev/null +++ b/tests/baselines/reference/deleteReadonly.js @@ -0,0 +1,30 @@ +//// [deleteReadonly.ts] +interface A { + readonly b +} +var a: A = { + b: 123 +}; + +delete a.b; + +interface B { + readonly [k: string]: string +} + +var b: B = { + 'test': 'test' +}; + +delete b['test']; + + +//// [deleteReadonly.js] +var a = { + b: 123 +}; +delete a.b; +var b = { + 'test': 'test' +}; +delete b['test']; diff --git a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt index 134a883540e..c08335f8598 100644 --- a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt @@ -1,19 +1,27 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(5,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(6,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(7,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,1): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(8,8): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(11,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(12,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(13,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,6): error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(14,13): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(16,1): error TS17006: An unary expression with the 'typeof' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -81,7 +89,7 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts(68,1): error TS17007: A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (81 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxError2.ts (89 errors) ==== // Error: early syntax error using ES7 SimpleUnaryExpression on left-hand side without () var temp: any; @@ -91,21 +99,29 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete --temp ** 3; @@ -113,21 +129,29 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorSyntaxE !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete ++temp ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete temp-- ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** delete temp++ ** 3; ~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~~~~~~~~~~~~~ !!! error TS17006: An unary expression with the 'delete' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference typeof --temp ** 3; ~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt index f43cbd0042a..24145c81158 100644 --- a/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt +++ b/tests/baselines/reference/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.errors.txt @@ -19,16 +19,24 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(25,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(26,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(28,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(29,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(30,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(31,9): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(33,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(34,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(35,14): error TS2698: The operand of a delete operator must be a property reference tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,6): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts(36,14): error TS2698: The operand of a delete operator must be a property reference -==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (28 errors) ==== +==== tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInvalidSimpleUnaryExpressionOperands.ts (36 errors) ==== var temp: any; // Error: incorrect type on left-hand side @@ -99,25 +107,41 @@ tests/cases/conformance/es7/exponentiationOperator/exponentiationOperatorWithInv (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference (delete temp++) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete --temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete ++temp) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete temp--) ** 3; ~~~~~~~~~~~~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference 1 ** (delete temp++) ** 3; ~~~~~~~~~~~~~~~ -!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/parserStrictMode16.errors.txt b/tests/baselines/reference/parserStrictMode16.errors.txt new file mode 100644 index 00000000000..edcda2787e1 --- /dev/null +++ b/tests/baselines/reference/parserStrictMode16.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(2,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(3,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(4,8): error TS2698: The operand of a delete operator must be a property reference +tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(5,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts (4 errors) ==== + "use strict"; + delete this; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete 1; + ~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete null; + ~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference + delete "a"; + ~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt index 7cc9e82b3b3..bf7a5cf0438 100644 --- a/tests/baselines/reference/symbolType3.errors.txt +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -1,3 +1,4 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(2,8): error TS2699: The operand of a delete operator cannot be a read-only property tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. @@ -6,9 +7,11 @@ tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' o tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. -==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (7 errors) ==== var s = Symbol(); delete Symbol.iterator; + ~~~~~~~~~~~~~~~ +!!! error TS2699: The operand of a delete operator cannot be a read-only property void Symbol.toPrimitive; typeof Symbol.toStringTag; ++s; diff --git a/tests/baselines/reference/templateStringInDeleteExpression.errors.txt b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt new file mode 100644 index 00000000000..9218b93b650 --- /dev/null +++ b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts(1,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts (1 errors) ==== + delete `abc${0}abc`; + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt new file mode 100644 index 00000000000..9ea14c39f2b --- /dev/null +++ b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts(1,8): error TS2698: The operand of a delete operator must be a property reference + + +==== tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts (1 errors) ==== + delete `abc${0}abc`; + ~~~~~~~~~~~~ +!!! error TS2698: The operand of a delete operator must be a property reference \ No newline at end of file diff --git a/tests/cases/compiler/deleteReadonly.ts b/tests/cases/compiler/deleteReadonly.ts new file mode 100644 index 00000000000..b7d35b3261b --- /dev/null +++ b/tests/cases/compiler/deleteReadonly.ts @@ -0,0 +1,18 @@ +interface A { + readonly b +} +var a: A = { + b: 123 +}; + +delete a.b; + +interface B { + readonly [k: string]: string +} + +var b: B = { + 'test': 'test' +}; + +delete b['test'];