-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
747f50f
commit 023d5ca
Showing
15 changed files
with
167 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/baselines/reference/controlFlowDeleteOperator.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
tests/cases/conformance/controlFlow/controlFlowDeleteOperator.ts(15,12): error TS2698: 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 TS2698: The operand of a delete operator must be a property reference | ||
x; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
tests/cases/compiler/deleteOperator1.ts(2,25): error TS2698: The operand of a delete operator must be a property reference | ||
tests/cases/compiler/deleteOperator1.ts(3,21): error TS2698: 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 TS2698: 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 TS2698: The operand of a delete operator must be a property reference | ||
var y: any = delete a; | ||
~ | ||
!!! error TS2698: 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'. | ||
!!! error TS2322: Type 'boolean' is not assignable to type 'number'. | ||
~ | ||
!!! error TS2698: The operand of a delete operator must be a property reference |
7 changes: 5 additions & 2 deletions
7
tests/baselines/reference/deleteOperatorInStrictMode.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 TS2698: 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. | ||
!!! error TS1102: 'delete' cannot be called on an identifier in strict mode. | ||
~ | ||
!!! error TS2698: The operand of a delete operator must be a property reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.