Improve error message on import "foo", module "foo", and import statements out of order.

This commit is contained in:
Christoffer Lerno
2021-07-12 21:02:51 +02:00
committed by Christoffer Lerno
parent 3173d09e56
commit 9ee24b5846
4 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
module foo;
func void hello() {}
import bar; // #error: Imports are only allowed directly after the module declaration

View File

@@ -0,0 +1 @@
import "Hello my friend"; // #error: An import should be followed by a plain identifier, not a string. Did you accidentally put the module name between ""?

View File

@@ -0,0 +1 @@
module "Hello my friend"; // #error: 'module' should be followed by a plain identifier, not a string. Did you accidentally put the module name between ""?