addressed PR feedback: added tests for let declarations

This commit is contained in:
Vladimir Matveev 2015-10-12 10:22:18 -07:00
parent adf9f9b8df
commit ca98831674
3 changed files with 49 additions and 1 deletions

View File

@ -2,9 +2,13 @@ tests/cases/compiler/exportedBlockScopedDeclarations.ts(1,13): error TS2448: Blo
tests/cases/compiler/exportedBlockScopedDeclarations.ts(2,20): error TS2448: Block-scoped variable 'bar' used before its declaration.
tests/cases/compiler/exportedBlockScopedDeclarations.ts(4,15): error TS2448: Block-scoped variable 'bar' used before its declaration.
tests/cases/compiler/exportedBlockScopedDeclarations.ts(7,22): error TS2448: Block-scoped variable 'bar' used before its declaration.
tests/cases/compiler/exportedBlockScopedDeclarations.ts(10,12): error TS2448: Block-scoped variable 'foo1' used before its declaration.
tests/cases/compiler/exportedBlockScopedDeclarations.ts(11,19): error TS2448: Block-scoped variable 'bar1' used before its declaration.
tests/cases/compiler/exportedBlockScopedDeclarations.ts(13,14): error TS2448: Block-scoped variable 'bar1' used before its declaration.
tests/cases/compiler/exportedBlockScopedDeclarations.ts(16,21): error TS2448: Block-scoped variable 'bar1' used before its declaration.
==== tests/cases/compiler/exportedBlockScopedDeclarations.ts (4 errors) ====
==== tests/cases/compiler/exportedBlockScopedDeclarations.ts (8 errors) ====
const foo = foo; // compile error
~~~
!!! error TS2448: Block-scoped variable 'foo' used before its declaration.
@ -20,4 +24,21 @@ tests/cases/compiler/exportedBlockScopedDeclarations.ts(7,22): error TS2448: Blo
export const bar = bar; // should be compile error
~~~
!!! error TS2448: Block-scoped variable 'bar' used before its declaration.
}
let foo1 = foo1; // compile error
~~~~
!!! error TS2448: Block-scoped variable 'foo1' used before its declaration.
export let bar1 = bar1; // should be compile error
~~~~
!!! error TS2448: Block-scoped variable 'bar1' used before its declaration.
function f1() {
let bar1 = bar1; // compile error
~~~~
!!! error TS2448: Block-scoped variable 'bar1' used before its declaration.
}
namespace NS1 {
export let bar1 = bar1; // should be compile error
~~~~
!!! error TS2448: Block-scoped variable 'bar1' used before its declaration.
}

View File

@ -6,6 +6,15 @@ function f() {
}
namespace NS {
export const bar = bar; // should be compile error
}
let foo1 = foo1; // compile error
export let bar1 = bar1; // should be compile error
function f1() {
let bar1 = bar1; // compile error
}
namespace NS1 {
export let bar1 = bar1; // should be compile error
}
//// [exportedBlockScopedDeclarations.js]
@ -19,4 +28,13 @@ define(["require", "exports"], function (require, exports) {
(function (NS) {
NS.bar = NS.bar; // should be compile error
})(NS || (NS = {}));
var foo1 = foo1; // compile error
exports.bar1 = exports.bar1; // should be compile error
function f1() {
var bar1 = bar1; // compile error
}
var NS1;
(function (NS1) {
NS1.bar1 = NS1.bar1; // should be compile error
})(NS1 || (NS1 = {}));
});

View File

@ -6,4 +6,13 @@ function f() {
}
namespace NS {
export const bar = bar; // should be compile error
}
let foo1 = foo1; // compile error
export let bar1 = bar1; // should be compile error
function f1() {
let bar1 = bar1; // compile error
}
namespace NS1 {
export let bar1 = bar1; // should be compile error
}