diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-08-05 12:01:39 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-08-05 16:37:42 +0200 |
commit | b4a3f6828478f1d831ae11ee4d3dcd82b93407c8 (patch) | |
tree | 935044691733689fbae18879a8bb70bf15672d75 /tests | |
parent | 5d5dadc65b7ab88360b1cbcfdca8f108018fed03 (diff) |
compiler: improve formatting of nested syntax error messages
Indent inner messages and prepend them with a vertical bar to increase
visual separation of messages. Also include file name in source context
output when the compiled program contains more than one source file.
Adjust affected testcase outputs accordingly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/custom/04_modules/06_export_errors | 26 | ||||
-rw-r--r-- | tests/custom/04_modules/07_import_default | 2 | ||||
-rw-r--r-- | tests/custom/04_modules/08_import_list | 2 | ||||
-rw-r--r-- | tests/custom/04_modules/12_import_immutability | 2 |
4 files changed, 15 insertions, 17 deletions
diff --git a/tests/custom/04_modules/06_export_errors b/tests/custom/04_modules/06_export_errors index c02a547..5c9f676 100644 --- a/tests/custom/04_modules/06_export_errors +++ b/tests/custom/04_modules/06_export_errors @@ -36,15 +36,14 @@ import "./files/test.uc"; -- Expect stderr -- Syntax error: Unable to compile module './files/test.uc': -Syntax error: Exports may only appear at top level of a module -In line 2, byte 2: - - ` export let x = 1;` - ^-- Near here - + | 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 line 1, byte 25: +In [stdin], line 1, byte 25: `import "./files/test.uc";` Near here --------------^ @@ -72,15 +71,14 @@ export { y as x }; -- Expect stderr -- Syntax error: Unable to compile module './files/test-duplicate.uc': -Syntax error: Duplicate export 'x' for module './files/test-duplicate.uc' -In line 4, byte 15: - - `export { y as x };` - Near here ----^ - + | 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 line 1, byte 35: +In [stdin], line 1, byte 35: `import "./files/test-duplicate.uc";` Near here ------------------------^ diff --git a/tests/custom/04_modules/07_import_default b/tests/custom/04_modules/07_import_default index 7190a22..d9d08b5 100644 --- a/tests/custom/04_modules/07_import_default +++ b/tests/custom/04_modules/07_import_default @@ -39,7 +39,7 @@ export const x = "This is a non-default export"; -- Expect stderr -- Syntax error: Module ./files/test2.uc has no default export -In line 1, byte 20: +In [stdin], line 1, byte 20: `import defVal from "./files/test2.uc";` Near here ---------^ diff --git a/tests/custom/04_modules/08_import_list b/tests/custom/04_modules/08_import_list index 1a4f116..b55ddec 100644 --- a/tests/custom/04_modules/08_import_list +++ b/tests/custom/04_modules/08_import_list @@ -38,7 +38,7 @@ export const x = "This is a test"; -- Expect stderr -- Syntax error: Module ./files/test2.uc has no default export -In line 1, byte 15: +In [stdin], line 1, byte 15: `import y from "./files/test2.uc";` Near here ----^ diff --git a/tests/custom/04_modules/12_import_immutability b/tests/custom/04_modules/12_import_immutability index 37c0bc6..48a7fe2 100644 --- a/tests/custom/04_modules/12_import_immutability +++ b/tests/custom/04_modules/12_import_immutability @@ -16,7 +16,7 @@ export let a = 1; -- Expect stderr -- Syntax error: Invalid assignment to constant 'a' -In line 3, byte 5: +In [stdin], line 3, byte 5: `a = 2;` ^-- Near here |