blob: 83227b16ffad6ebc456e5d345f8931d2f681e104 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
Export statements are only allowed at the toplevel of a module.
-- Testcase --
export let x = 1;
-- End --
-- Args --
-R
-- End --
-- Expect stderr --
Syntax error: Exports may only appear at top level of a module
In line 1, byte 1:
`export let x = 1;`
^-- Near here
-- End --
Export statements are not allowed within functions or nested blocks.
-- Testcase --
import "./files/test.uc";
-- End --
-- File test.uc --
{
export let x = 1;
}
-- End --
-- Args --
-R
-- End --
-- Expect stderr --
Syntax error: Unable to compile module './files/test.uc':
| Syntax error: Exports may only appear at top level of a module
| In ./files/test.uc, line 2, byte 2:
|
| ` export let x = 1;`
| ^-- Near here
In [stdin], line 1, byte 25:
`import "./files/test.uc";`
Near here --------------^
-- End --
Duplicate export names should result in an error.
-- Testcase --
import "./files/test-duplicate.uc";
-- End --
-- File test-duplicate.uc --
let x = 1, y = 2;
export { x };
export { y as x };
-- End --
-- Args --
-R
-- End --
-- Expect stderr --
Syntax error: Unable to compile module './files/test-duplicate.uc':
| Syntax error: Duplicate export 'x' for module './files/test-duplicate.uc'
| In ./files/test-duplicate.uc, line 4, byte 15:
|
| `export { y as x };`
| Near here ----^
In [stdin], line 1, byte 35:
`import "./files/test-duplicate.uc";`
Near here ------------------------^
-- End --
|