File tree Expand file tree Collapse file tree 2 files changed +49
-3
lines changed
cases/conformance/statements/tryStatements Expand file tree Collapse file tree 2 files changed +49
-3
lines changed Original file line number Diff line number Diff line change 1
- ==== tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts (2 errors) ====
1
+ ==== tests/cases/conformance/statements/tryStatements/invalidTryStatements2.ts (6 errors) ====
2
2
function fn() {
3
3
try {
4
4
} catch { // syntax error, missing '(x)'
10
10
~~~~~
11
11
!!! A 'catch' clause must be preceded by a 'try' statement.
12
12
13
- finally{ } // error missing try
13
+ finally{ } // potential error; can be absorbed by the 'catch'
14
+ }
15
+
16
+ function fn2() {
17
+ finally { } // error missing try
18
+ ~~~~~~~
19
+ !!! A 'finally' block must be preceded by a 'try' statement.
20
+ catch (x) { } // error missing try
21
+ ~~~~~
22
+ !!! A 'catch' clause must be preceded by a 'try' statement.
23
+
24
+ // no error
25
+ try {
26
+ }
27
+ finally {
28
+ }
29
+
30
+ // error missing try
31
+ finally {
32
+ ~~~~~~~
33
+ !!! A 'finally' block must be preceded by a 'try' statement.
34
+ }
35
+
36
+ // error missing try
37
+ catch (x) {
38
+ ~~~~~
39
+ !!! A 'catch' clause must be preceded by a 'try' statement.
40
+ }
14
41
}
Original file line number Diff line number Diff line change @@ -5,5 +5,24 @@ function fn() {
5
5
6
6
catch ( x ) { } // error missing try
7
7
8
- finally { } // error missing try
8
+ finally { } // potential error; can be absorbed by the 'catch'
9
+ }
10
+
11
+ function fn2 ( ) {
12
+ finally { } // error missing try
13
+ catch ( x ) { } // error missing try
14
+
15
+ // no error
16
+ try {
17
+ }
18
+ finally {
19
+ }
20
+
21
+ // error missing try
22
+ finally {
23
+ }
24
+
25
+ // error missing try
26
+ catch ( x ) {
27
+ }
9
28
}
You can’t perform that action at this time.
0 commit comments