diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts
index c3a3f2b6416c3..182bb22a3726d 100644
--- a/src/compiler/checker.ts
+++ b/src/compiler/checker.ts
@@ -6072,7 +6072,7 @@ namespace ts {
getIndexInfoOfType(objectType, IndexKind.String) ||
undefined;
if (indexInfo) {
- if (accessExpression && isAssignmentTarget(accessExpression) && indexInfo.isReadonly) {
+ if (accessExpression && indexInfo.isReadonly && (isAssignmentTarget(accessExpression) || isDeleteTarget(accessExpression))) {
error(accessExpression, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
return unknownType;
}
@@ -14386,6 +14386,16 @@ namespace ts {
function checkDeleteExpression(node: DeleteExpression): Type {
checkExpression(node.expression);
+ const expr = skipParentheses(node.expression);
+ if (expr.kind !== SyntaxKind.PropertyAccessExpression && expr.kind !== SyntaxKind.ElementAccessExpression) {
+ error(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
+ return booleanType;
+ }
+ const links = getNodeLinks(expr);
+ const symbol = getExportSymbolOfValueSymbolIfExported(links.resolvedSymbol);
+ if (symbol && isReadonlySymbol(symbol)) {
+ error(expr, Diagnostics.The_operand_of_a_delete_operator_cannot_be_a_read_only_property);
+ }
return booleanType;
}
diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json
index 7e8dc1ce20924..5476715468bdc 100644
--- a/src/compiler/diagnosticMessages.json
+++ b/src/compiler/diagnosticMessages.json
@@ -2019,6 +2019,14 @@
"category": "Error",
"code": 2702
},
+ "The operand of a delete operator must be a property reference": {
+ "category": "Error",
+ "code": 2703
+ },
+ "The operand of a delete operator cannot be a read-only property": {
+ "category": "Error",
+ "code": 2704
+ },
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index c2e354bd58dc7..34d857e449a68 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -1,4 +1,4 @@
-///
+///
/* @internal */
namespace ts {
@@ -1668,6 +1668,18 @@ namespace ts {
return getAssignmentTargetKind(node) !== AssignmentKind.None;
}
+ // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
+ export function isDeleteTarget(node: Node): boolean {
+ if (node.kind !== SyntaxKind.PropertyAccessExpression && node.kind !== SyntaxKind.ElementAccessExpression) {
+ return false;
+ }
+ node = node.parent;
+ while (node && node.kind === SyntaxKind.ParenthesizedExpression) {
+ node = node.parent;
+ }
+ return node && node.kind === SyntaxKind.DeleteExpression;
+ }
+
export function isNodeDescendantOf(node: Node, ancestor: Node): boolean {
while (node) {
if (node === ancestor) return true;
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 0000000000000..4a38371829dee
--- /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 TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/async/es2017/await_unaryExpression_es2017_1.ts(11,12): error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ }
+
+ async function bar2() {
+ delete await 42; // OK
+ ~~~~~~~~
+!!! error TS2703: 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 0000000000000..0f80ec02334bb
--- /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 TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/async/es2017/await_unaryExpression_es2017_2.ts(7,12): error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ }
+
+ async function bar2() {
+ delete await 42;
+ ~~~~~~~~
+!!! error TS2703: 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 0000000000000..8212c2dd2917d
--- /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 TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/async/es6/await_unaryExpression_es6_1.ts(11,12): error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ }
+
+ async function bar2() {
+ delete await 42; // OK
+ ~~~~~~~~
+!!! error TS2703: 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 0000000000000..cde22cc5549ab
--- /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 TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/async/es6/await_unaryExpression_es6_2.ts(7,12): error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ }
+
+ async function bar2() {
+ delete await 42;
+ ~~~~~~~~
+!!! error TS2703: 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/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt
index fd6f8e8bdc1c6..4c54e9ad61f20 100644
--- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt
+++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt
@@ -2,12 +2,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,1
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,17): error TS2703: The operand of a delete operator must be a property reference
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
-==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (7 errors) ====
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (8 errors) ====
var id;
class C {
[0 + 1]() { }
@@ -21,6 +22,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,1
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
~~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
+ ~~
+!!! error TS2703: The operand of a delete operator must be a property reference
set [[0, 1]](v) { }
~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
diff --git a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt
index 4299437777d5e..9b7221563c2e9 100644
--- a/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt
+++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt
@@ -2,12 +2,13 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,1
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS1102: 'delete' cannot be called on an identifier in strict mode.
+tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,17): error TS2703: The operand of a delete operator must be a property reference
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value.
tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
-==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (7 errors) ====
+==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (8 errors) ====
var id;
class C {
[0 + 1]() { }
@@ -21,6 +22,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,1
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
~~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
+ ~~
+!!! error TS2703: The operand of a delete operator must be a property reference
set [[0, 1]](v) { }
~~~~~~~~
!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'.
diff --git a/tests/baselines/reference/controlFlowDeleteOperator.errors.txt b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt
new file mode 100644
index 0000000000000..de84d602c9517
--- /dev/null
+++ b/tests/baselines/reference/controlFlowDeleteOperator.errors.txt
@@ -0,0 +1,23 @@
+tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error TS2703: The operand of a delete operator must be a property reference
+
+
+==== tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts (1 errors) ====
+
+ function f() {
+ let x: { a?: number | string, b: number | string } = { b: 1 };
+ x.a;
+ x.b;
+ x.a = 1;
+ x.b = 1;
+ x.a;
+ x.b;
+ delete x.a;
+ delete x.b;
+ x.a;
+ x.b;
+ x;
+ delete x; // No effect
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ x;
+ }
\ No newline at end of file
diff --git a/tests/baselines/reference/deleteOperator1.errors.txt b/tests/baselines/reference/deleteOperator1.errors.txt
index 964bdec9ea2ca..09a839d10b44f 100644
--- a/tests/baselines/reference/deleteOperator1.errors.txt
+++ b/tests/baselines/reference/deleteOperator1.errors.txt
@@ -1,10 +1,19 @@
+tests/cases/compiler/deleteOperator1.ts(2,25): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/compiler/deleteOperator1.ts(3,21): error TS2703: The operand of a delete operator must be a property reference
tests/cases/compiler/deleteOperator1.ts(4,5): error TS2322: Type 'boolean' is not assignable to type 'number'.
+tests/cases/compiler/deleteOperator1.ts(4,24): error TS2703: The operand of a delete operator must be a property reference
-==== tests/cases/compiler/deleteOperator1.ts (1 errors) ====
+==== tests/cases/compiler/deleteOperator1.ts (4 errors) ====
var a;
var x: boolean = delete a;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
var y: any = delete a;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
var z: number = delete a;
~
-!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
\ No newline at end of file
+!!! error TS2322: Type 'boolean' is not assignable to type 'number'.
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
\ No newline at end of file
diff --git a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt
index 5952d8b829636..16d3b7723514c 100644
--- a/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt
+++ b/tests/baselines/reference/deleteOperatorInStrictMode.errors.txt
@@ -1,9 +1,12 @@
tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS1102: 'delete' cannot be called on an identifier in strict mode.
+tests/cases/compiler/deleteOperatorInStrictMode.ts(3,8): error TS2703: The operand of a delete operator must be a property reference
-==== tests/cases/compiler/deleteOperatorInStrictMode.ts (1 errors) ====
+==== tests/cases/compiler/deleteOperatorInStrictMode.ts (2 errors) ====
"use strict"
var a;
delete a;
~
-!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
\ No newline at end of file
+!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
\ No newline at end of file
diff --git a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt
index d50be713d0a9a..3e581f5a77be7 100644
--- a/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt
+++ b/tests/baselines/reference/deleteOperatorInvalidOperations.errors.txt
@@ -1,10 +1,13 @@
tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,20): error TS1005: ',' expected.
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,26): error TS2703: The operand of a delete operator must be a property reference
tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(5,27): error TS1109: Expression expected.
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,22): error TS2703: The operand of a delete operator must be a property reference
tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(8,23): error TS1109: Expression expected.
tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS1102: 'delete' cannot be called on an identifier in strict mode.
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts(13,16): error TS2703: The operand of a delete operator must be a property reference
-==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (4 errors) ====
+==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorInvalidOperations.ts (7 errors) ====
// Unary operator delete
var ANY;
@@ -12,11 +15,15 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator
var BOOLEAN1 = ANY delete ; //expect error
~~~~~~
!!! error TS1005: ',' expected.
+
+!!! error TS2703: The operand of a delete operator must be a property reference
~
!!! error TS1109: Expression expected.
// miss an operand
var BOOLEAN2 = delete ;
+
+!!! error TS2703: The operand of a delete operator must be a property reference
~
!!! error TS1109: Expression expected.
@@ -26,5 +33,7 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator
delete s; //expect error
~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
}
}
\ No newline at end of file
diff --git a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt
index 73ddab1a33c67..69153fc235c4d 100644
--- a/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt
+++ b/tests/baselines/reference/deleteOperatorWithAnyOtherType.errors.txt
@@ -1,9 +1,31 @@
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(25,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(26,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(27,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(28,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(29,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(33,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(34,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(42,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(43,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(44,33): error TS2703: 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(45,33): error TS2703: 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(46,33): error TS2703: 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(47,33): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(50,39): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,39): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(51,47): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(54,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(55,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithAnyOtherType.ts(57,8): error TS2703: 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 (25 errors) ====
// delete operator on any type
var ANY: any;
@@ -29,15 +51,31 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator
// any type var
var ResultIsBoolean1 = delete ANY1;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean2 = delete ANY2;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean3 = delete A;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean4 = delete M;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean5 = delete obj;
+ ~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean6 = delete obj1;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
// any type literal
var ResultIsBoolean7 = delete undefined;
+ ~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean8 = delete null;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
// any type expressions
var ResultIsBoolean9 = delete ANY2[0];
@@ -46,27 +84,55 @@ tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperator
var ResultIsBoolean12 = delete objA.a;
var ResultIsBoolean13 = delete M.n;
var ResultIsBoolean14 = delete foo();
+ ~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean15 = delete A.foo();
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean16 = delete (ANY + ANY1);
+ ~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean17 = delete (null + undefined);
~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
+ ~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean18 = delete (null + null);
~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
+ ~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean19 = delete (undefined + undefined);
~~~~~~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
+ ~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
// multiple delete operators
var ResultIsBoolean20 = delete delete ANY;
+ ~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
var ResultIsBoolean21 = delete delete delete (ANY + ANY1);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
// miss assignment operators
delete ANY;
+ ~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
delete ANY1;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
delete ANY2[0];
delete ANY, ANY1;
+ ~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
delete obj1.x;
delete obj1.y;
delete objA.a;
diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt
new file mode 100644
index 0000000000000..83ce7db9f3365
--- /dev/null
+++ b/tests/baselines/reference/deleteOperatorWithBooleanType.errors.txt
@@ -0,0 +1,74 @@
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(17,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(20,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(21,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(26,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(27,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(30,38): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(33,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(34,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(35,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts(36,8): error TS2703: The operand of a delete operator must be a property reference
+
+
+==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithBooleanType.ts (11 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;
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // boolean type literal
+ var ResultIsBoolean2 = delete true;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean3 = delete { x: true, y: false };
+ ~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean7 = delete A.foo();
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // multiple delete operator
+ var ResultIsBoolean8 = delete delete BOOLEAN;
+ ~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // miss assignment operators
+ delete true;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete BOOLEAN;
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete foo();
+ ~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete true, false;
+ ~~~~
+!!! error TS2703: 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 0000000000000..84c1ed48017f7
--- /dev/null
+++ b/tests/baselines/reference/deleteOperatorWithEnumType.errors.txt
@@ -0,0 +1,64 @@
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(7,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(8,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(11,31): error TS2704: The operand of a delete operator cannot be a read-only property
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(12,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(15,38): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,38): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(16,46): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(19,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(20,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(21,8): error TS2704: The operand of a delete operator cannot be a read-only property
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithEnumType.ts(22,8): error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean2 = delete ENUM1;
+ ~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // enum type expressions
+ var ResultIsBoolean3 = delete ENUM1["A"];
+ ~~~~~~~~~~
+!!! error TS2704: The operand of a delete operator cannot be a read-only property
+ var ResultIsBoolean4 = delete (ENUM[0] + ENUM1["B"]);
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // multiple delete operators
+ var ResultIsBoolean5 = delete delete ENUM;
+ ~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean6 = delete delete delete (ENUM[0] + ENUM1["B"]);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // miss assignment operators
+ delete ENUM;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete ENUM1;
+ ~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete ENUM1.B;
+ ~~~~~~~
+!!! error TS2704: The operand of a delete operator cannot be a read-only property
+ delete ENUM, ENUM1;
+ ~~~~
+!!! error TS2703: 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 0000000000000..b43c7aa8e3db4
--- /dev/null
+++ b/tests/baselines/reference/deleteOperatorWithNumberType.errors.txt
@@ -0,0 +1,99 @@
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(18,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(19,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(22,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(23,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(24,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(31,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(32,33): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(35,39): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,39): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(36,47): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(39,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(40,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(41,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts(42,8): error TS2703: The operand of a delete operator must be a property reference
+
+
+==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithNumberType.ts (17 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;
+ ~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean2 = delete NUMBER1;
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // number type literal
+ var ResultIsBoolean3 = delete 1;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean4 = delete { x: 1, y: 2};
+ ~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean5 = delete { x: 1, y: (n: number) => { return n; } };
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean10 = delete A.foo();
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean11 = delete (NUMBER + NUMBER);
+ ~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // multiple delete operator
+ var ResultIsBoolean12 = delete delete NUMBER;
+ ~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean13 = delete delete delete (NUMBER + NUMBER);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // miss assignment operators
+ delete 1;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete NUMBER;
+ ~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete NUMBER1;
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete foo();
+ ~~~~~
+!!! error TS2703: 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 0000000000000..37859d3ab2442
--- /dev/null
+++ b/tests/baselines/reference/deleteOperatorWithStringType.errors.txt
@@ -0,0 +1,101 @@
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(18,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(19,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(22,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(23,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(24,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(30,31): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(31,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(32,33): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(33,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(36,39): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,32): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,39): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(37,47): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(40,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(41,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(42,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts(43,8): error TS2703: The operand of a delete operator must be a property reference
+
+
+==== tests/cases/conformance/expressions/unaryOperators/deleteOperator/deleteOperatorWithStringType.ts (18 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;
+ ~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean2 = delete STRING1;
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // string type literal
+ var ResultIsBoolean3 = delete "";
+ ~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean4 = delete { x: "", y: "" };
+ ~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean5 = delete { x: "", y: (s: string) => { return s; } };
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean10 = delete A.foo();
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean11 = delete (STRING + STRING);
+ ~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean12 = delete STRING.charAt(0);
+ ~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // multiple delete operator
+ var ResultIsBoolean13 = delete delete STRING;
+ ~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ var ResultIsBoolean14 = delete delete delete (STRING + STRING);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ ~~~~~~~~~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+
+ // miss assignment operators
+ delete "";
+ ~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete STRING;
+ ~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete STRING1;
+ ~~~~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete foo();
+ ~~~~~
+!!! error TS2703: 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 0000000000000..4e5a3275b800e
--- /dev/null
+++ b/tests/baselines/reference/deleteReadonly.errors.txt
@@ -0,0 +1,33 @@
+tests/cases/compiler/deleteReadonly.ts(8,8): error TS2704: The operand of a delete operator cannot be a read-only property
+tests/cases/compiler/deleteReadonly.ts(18,8): error TS2542: Index signature in type 'B' only permits reading.
+tests/cases/compiler/deleteReadonly.ts(20,12): error TS2542: Index signature in type 'B' only permits reading.
+
+
+==== tests/cases/compiler/deleteReadonly.ts (3 errors) ====
+ interface A {
+ readonly b
+ }
+ var a: A = {
+ b: 123
+ };
+
+ delete a.b;
+ ~~~
+!!! error TS2704: 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 TS2542: Index signature in type 'B' only permits reading.
+
+ delete ((((b['test']))));
+ ~~~~~~~~~
+!!! error TS2542: Index signature in type 'B' only permits reading.
+
\ 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 0000000000000..bdfdf155546de
--- /dev/null
+++ b/tests/baselines/reference/deleteReadonly.js
@@ -0,0 +1,33 @@
+//// [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'];
+
+delete ((((b['test']))));
+
+
+//// [deleteReadonly.js]
+var a = {
+ b: 123
+};
+delete a.b;
+var b = {
+ 'test': 'test'
+};
+delete b['test'];
+delete ((((b['test']))));
diff --git a/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt b/tests/baselines/reference/exponentiationOperatorSyntaxError2.errors.txt
index 134a883540efd..6ac93ecf27a0a 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 f43cbd0042a04..b643a71c5c8fe 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: 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 TS2703: The operand of a delete operator must be a property reference
\ No newline at end of file
diff --git a/tests/baselines/reference/parserStrictMode15.errors.txt b/tests/baselines/reference/parserStrictMode15.errors.txt
index 0bcaaf337860e..831d214c9fb36 100644
--- a/tests/baselines/reference/parserStrictMode15.errors.txt
+++ b/tests/baselines/reference/parserStrictMode15.errors.txt
@@ -1,11 +1,14 @@
tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS1102: 'delete' cannot be called on an identifier in strict mode.
tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2304: Cannot find name 'a'.
+tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts(2,8): error TS2703: The operand of a delete operator must be a property reference
-==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (2 errors) ====
+==== tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode15.ts (3 errors) ====
"use strict";
delete a;
~
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode.
~
-!!! error TS2304: Cannot find name 'a'.
\ No newline at end of file
+!!! error TS2304: Cannot find name 'a'.
+ ~
+!!! error TS2703: 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 0000000000000..fe99c33723243
--- /dev/null
+++ b/tests/baselines/reference/parserStrictMode16.errors.txt
@@ -0,0 +1,20 @@
+tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(2,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(3,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(4,8): error TS2703: The operand of a delete operator must be a property reference
+tests/cases/conformance/parser/ecmascript5/StrictMode/parserStrictMode16.ts(5,8): error TS2703: 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 TS2703: The operand of a delete operator must be a property reference
+ delete 1;
+ ~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete null;
+ ~~~~
+!!! error TS2703: The operand of a delete operator must be a property reference
+ delete "a";
+ ~~~
+!!! error TS2703: 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 7cc9e82b3b3da..04a71789031a2 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 TS2704: 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 TS2704: 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 0000000000000..6cc310969b64c
--- /dev/null
+++ b/tests/baselines/reference/templateStringInDeleteExpression.errors.txt
@@ -0,0 +1,7 @@
+tests/cases/conformance/es6/templates/templateStringInDeleteExpression.ts(1,8): error TS2703: 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 TS2703: 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 0000000000000..a3b89c880c818
--- /dev/null
+++ b/tests/baselines/reference/templateStringInDeleteExpressionES6.errors.txt
@@ -0,0 +1,7 @@
+tests/cases/conformance/es6/templates/templateStringInDeleteExpressionES6.ts(1,8): error TS2703: 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 TS2703: 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 0000000000000..cdab3f2eb234d
--- /dev/null
+++ b/tests/cases/compiler/deleteReadonly.ts
@@ -0,0 +1,20 @@
+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'];
+
+delete ((((b['test']))));