Skip to content

Commit b5c64ad

Browse files
committed
Test case for binder errors in .js file
1 parent 937ce71 commit b5c64ad

4 files changed

Lines changed: 87 additions & 0 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//// [a.js]
2+
let C = "sss";
3+
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
4+
5+
function f() {
6+
return;
7+
return; // Error: Unreachable code detected.
8+
}
9+
10+
function b() {
11+
"use strict";
12+
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
13+
}
14+
15+
//// [a.js]
16+
var C = "sss";
17+
var C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
18+
function f() {
19+
return;
20+
return; // Error: Unreachable code detected.
21+
}
22+
function b() {
23+
"use strict";
24+
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
=== tests/cases/compiler/a.js ===
2+
let C = "sss";
3+
>C : Symbol(C, Decl(a.js, 0, 3))
4+
5+
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
6+
>C : Symbol(C, Decl(a.js, 1, 3))
7+
8+
function f() {
9+
>f : Symbol(f, Decl(a.js, 1, 10))
10+
11+
return;
12+
return; // Error: Unreachable code detected.
13+
}
14+
15+
function b() {
16+
>b : Symbol(b, Decl(a.js, 6, 1))
17+
18+
"use strict";
19+
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
20+
>arguments : Symbol(arguments, Decl(a.js, 10, 7))
21+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
=== tests/cases/compiler/a.js ===
2+
let C = "sss";
3+
>C : string
4+
>"sss" : string
5+
6+
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
7+
>C : number
8+
>0 : number
9+
10+
function f() {
11+
>f : () => void
12+
13+
return;
14+
return; // Error: Unreachable code detected.
15+
}
16+
17+
function b() {
18+
>b : () => void
19+
20+
"use strict";
21+
>"use strict" : string
22+
23+
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
24+
>arguments : number
25+
>0 : number
26+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @allowJs: true
2+
// @noEmit: true
3+
// @filename: a.js
4+
let C = "sss";
5+
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
6+
7+
function f() {
8+
return;
9+
return; // Error: Unreachable code detected.
10+
}
11+
12+
function b() {
13+
"use strict";
14+
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
15+
}

0 commit comments

Comments
 (0)