Skip to content

Commit dfe80bc

Browse files
Copilotcamc314
andcommitted
Add test cases for declare-before-export and duplicate-declare modifiers
- declare-before-export-modifier.ts: Tests `declare export function foo() {}` - duplicate-declare-modifier.ts: Tests `declare declare function foo() {}` Both produce correct TS(1030) diagnostics for duplicate modifiers. Co-authored-by: camc314 <[email protected]>
1 parent e22de43 commit dfe80bc

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare export function foo() {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
declare declare function foo() {}

tasks/coverage/snapshots/parser_misc.snap

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parser_misc Summary:
22
AST Parsed : 51/51 (100.00%)
33
Positive Passed: 51/51 (100.00%)
4-
Negative Passed: 119/119 (100.00%)
4+
Negative Passed: 121/121 (100.00%)
55

66
× Cannot assign to 'arguments' in strict mode
77
╭─[misc/fail/arguments-eval.ts:1:10]
@@ -50,6 +50,26 @@ Negative Passed: 119/119 (100.00%)
5050
8
5151
╰────
5252

53+
× TS(1030): 'export' modifier already seen.
54+
╭─[misc/fail/declare-before-export-modifier.ts:1:9]
55+
1declare export function foo() {}
56+
· ──────
57+
╰────
58+
help: Remove the duplicate modifier.
59+
60+
× TS(1183): An implementation cannot be declared in ambient contexts.
61+
╭─[misc/fail/declare-before-export-modifier.ts:1:31]
62+
1declare export function foo() {}
63+
· ▲
64+
╰────
65+
66+
× 'export' modifier cannot be used here.
67+
╭─[misc/fail/declare-before-export-modifier.ts:1:9]
68+
1declare export function foo() {}
69+
· ──────
70+
╰────
71+
help: Allowed modifiers are: declare, async
72+
5373
× Encountered diff marker
5474
╭─[misc/fail/diff-markers.js:10:1]
5575
9function test() {
@@ -72,6 +92,19 @@ Negative Passed: 119/119 (100.00%)
7292
If you're in the middle of a rebase, the top section is the code being rebased onto and the bottom section is the code coming from the current commit being rebased.
7393
If you have nested conflicts, resolve the outermost conflict first.
7494

95+
× TS(1030): 'declare' modifier already seen.
96+
╭─[misc/fail/duplicate-declare-modifier.ts:1:9]
97+
1declare declare function foo() {}
98+
· ───────
99+
╰────
100+
help: Remove the duplicate modifier.
101+
102+
× TS(1183): An implementation cannot be declared in ambient contexts.
103+
╭─[misc/fail/duplicate-declare-modifier.ts:1:32]
104+
1declare declare function foo() {}
105+
· ▲
106+
╰────
107+
75108
× TS(1030): 'export' modifier already seen.
76109
╭─[misc/fail/duplicate-export-modifier.ts:1:8]
77110
1export export function foo() {

0 commit comments

Comments
 (0)