diff --git a/vlib/compiler/main.v b/vlib/compiler/main.v index d5b17e8c01..b214daea64 100644 --- a/vlib/compiler/main.v +++ b/vlib/compiler/main.v @@ -828,7 +828,7 @@ pub fn (v mut V) parse_lib_imports() { pidx := v.parse(file, .imports) p_mod := v.parsers[pidx].mod if p_mod != mod { - v.parsers[pidx].error_with_token_index('bad module definition: ${v.parsers[pidx].file_path} imports module "$mod" but $file is defined as module `$p_mod`', 1) + v.parsers[pidx].error_with_token_index('bad module definition: ${v.parsers[pidx].file_path} imports module "$mod" but $file is defined as module `$p_mod`', 0) } } done_imports << mod diff --git a/vlib/compiler/tests/modules/acommentedmodule/commentedfile.v b/vlib/compiler/tests/modules/acommentedmodule/commentedfile.v new file mode 100644 index 0000000000..6e7af6f77e --- /dev/null +++ b/vlib/compiler/tests/modules/acommentedmodule/commentedfile.v @@ -0,0 +1,5 @@ +/* +module acommentedmodule + + +*/ diff --git a/vlib/compiler/tests/repl/entire_commented_module.repl b/vlib/compiler/tests/repl/entire_commented_module.repl new file mode 100644 index 0000000000..1a9e839d33 --- /dev/null +++ b/vlib/compiler/tests/repl/entire_commented_module.repl @@ -0,0 +1,3 @@ +import compiler.tests.modules.acommentedmodule +===output=== +vlib/compiler/tests/modules/acommentedmodule/commentedfile.v:7:1: bad module definition: vlib/compiler/tests/modules/acommentedmodule/commentedfile.v imports module "compiler.tests.modules.acommentedmodule" but vlib/compiler/tests/modules/acommentedmodule/commentedfile.v is defined as module `main` diff --git a/vlib/compiler/tests/repl/runner/runner.v b/vlib/compiler/tests/repl/runner/runner.v index d86ec533ee..19f6d3d688 100644 --- a/vlib/compiler/tests/repl/runner/runner.v +++ b/vlib/compiler/tests/repl/runner/runner.v @@ -51,6 +51,7 @@ fn diff_files( file_result, file_expected string ) string { } pub fn run_repl_file(wd string, vexec string, file string) ?string { + vexec_folder := filepath.dir(vexec) + filepath.separator fcontent := os.read_file(file) or { return error('Could not read file ${file}') } content := fcontent.replace('\r', '') input := content.all_before('===output===\n') @@ -74,6 +75,8 @@ pub fn run_repl_file(wd string, vexec string, file string) ?string { .replace('... ', '') .all_after('Use Ctrl-C or `exit` to exit\n') .replace(wd + filepath.separator, '' ) + .replace(vexec_folder, '') + .replace('\\', '/') if result != output { file_result := '${file}.result.txt'