mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Added tests for let/const variable declarations in catch clause (with the same name)
This commit is contained in:
parent
129ef7222c
commit
2edb5c88d8
@ -0,0 +1,31 @@
|
||||
tests/cases/compiler/redeclareParameterInCatchBlock.ts(5,11): error TS2492: Cannot redeclare identifier 'e' in catch clause
|
||||
tests/cases/compiler/redeclareParameterInCatchBlock.ts(11,9): error TS2492: Cannot redeclare identifier 'e' in catch clause
|
||||
|
||||
|
||||
==== tests/cases/compiler/redeclareParameterInCatchBlock.ts (2 errors) ====
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
const e = null;
|
||||
~
|
||||
!!! error TS2492: Cannot redeclare identifier 'e' in catch clause
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
let e;
|
||||
~
|
||||
!!! error TS2492: Cannot redeclare identifier 'e' in catch clause
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
function test() {
|
||||
let e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
42
tests/baselines/reference/redeclareParameterInCatchBlock.js
Normal file
42
tests/baselines/reference/redeclareParameterInCatchBlock.js
Normal file
@ -0,0 +1,42 @@
|
||||
//// [redeclareParameterInCatchBlock.ts]
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
const e = null;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
let e;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
function test() {
|
||||
let e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//// [redeclareParameterInCatchBlock.js]
|
||||
try {
|
||||
}
|
||||
catch (e) {
|
||||
const e = null;
|
||||
}
|
||||
try {
|
||||
}
|
||||
catch (e) {
|
||||
let e;
|
||||
}
|
||||
try {
|
||||
}
|
||||
catch (e) {
|
||||
function test() {
|
||||
let e;
|
||||
}
|
||||
}
|
||||
22
tests/cases/compiler/redeclareParameterInCatchBlock.ts
Normal file
22
tests/cases/compiler/redeclareParameterInCatchBlock.ts
Normal file
@ -0,0 +1,22 @@
|
||||
// @target: es6
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
const e = null;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
let e;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
} catch(e) {
|
||||
function test() {
|
||||
let e;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user