Skip to content

Add tests for let declarations/identifier variables #7165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/baselines/reference/VariableDeclaration12_es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//// [VariableDeclaration12_es6.ts]

let
x

//// [VariableDeclaration12_es6.js]
let x;
6 changes: 6 additions & 0 deletions tests/baselines/reference/VariableDeclaration12_es6.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts ===

let
x
>x : Symbol(x, Decl(VariableDeclaration12_es6.ts, 1, 3))

6 changes: 6 additions & 0 deletions tests/baselines/reference/VariableDeclaration12_es6.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration12_es6.ts ===

let
x
>x : any

20 changes: 20 additions & 0 deletions tests/baselines/reference/VariableDeclaration13_es6.errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,5): error TS1181: Array element destructuring pattern expected.
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,6): error TS1005: ',' expected.
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,8): error TS1134: Variable declaration expected.
tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts(5,10): error TS1134: Variable declaration expected.


==== tests/cases/conformance/es6/variableDeclarations/VariableDeclaration13_es6.ts (4 errors) ====

// An ExpressionStatement cannot start with the two token sequence `let [` because
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
var let: any;
let[0] = 100;
~
!!! error TS1181: Array element destructuring pattern expected.
~
!!! error TS1005: ',' expected.
~
!!! error TS1134: Variable declaration expected.
~~~
!!! error TS1134: Variable declaration expected.
13 changes: 13 additions & 0 deletions tests/baselines/reference/VariableDeclaration13_es6.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//// [VariableDeclaration13_es6.ts]

// An ExpressionStatement cannot start with the two token sequence `let [` because
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
var let: any;
let[0] = 100;

//// [VariableDeclaration13_es6.js]
// An ExpressionStatement cannot start with the two token sequence `let [` because
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
var let;
let [] = 0;
100;
7 changes: 7 additions & 0 deletions tests/baselines/reference/letIdentifierInElementAccess01.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//// [letIdentifierInElementAccess01.ts]
var let: any = {};
(let[0] = 100);

//// [letIdentifierInElementAccess01.js]
var let = {};
(let[0] = 100);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts ===
var let: any = {};
>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3))

(let[0] = 100);
>let : Symbol(let, Decl(letIdentifierInElementAccess01.ts, 0, 3))

13 changes: 13 additions & 0 deletions tests/baselines/reference/letIdentifierInElementAccess01.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
=== tests/cases/conformance/expressions/elementAccess/letIdentifierInElementAccess01.ts ===
var let: any = {};
>let : any
>{} : {}

(let[0] = 100);
>(let[0] = 100) : number
>let[0] = 100 : number
>let[0] : any
>let : any
>0 : number
>100 : number

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @target:es6

let
x
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @target:es6

// An ExpressionStatement cannot start with the two token sequence `let [` because
// that would make it ambiguous with a `let` LexicalDeclaration whose first LexicalBinding was an ArrayBindingPattern.
var let: any;
let[0] = 100;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var let: any = {};
(let[0] = 100);