Browse Source

[typer] make the invalid package error even clearer

Just spell out the package statements to avoid the confusing <empty> syntax. Example:

    `package;` in source/foo/Foo.hx should be `package foo;`
Jens Fischer 6 năm trước cách đây
mục cha
commit
d415a7d8f1
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/typing/typeloadParse.ml

+ 2 - 2
src/typing/typeloadParse.ml

@@ -171,11 +171,11 @@ let parse_module' com m p =
 let parse_module ctx m p =
 	let file,remap,pack,decls = parse_module' ctx.com m p in
 	if pack <> !remap then begin
-		let spack m = if m = [] then "<empty>" else String.concat "." m in
+		let spack m = if m = [] then "`package;`" else "`package " ^ (String.concat "." m) ^ ";`" in
 		if p == null_pos then
 			display_error ctx ("Invalid commandline class : " ^ s_type_path m ^ " should be " ^ s_type_path (pack,snd m)) p
 		else
-			display_error ctx ("Invalid package : " ^ spack (fst m) ^ " should be " ^ spack pack ^ " in " ^ file) {p with pmax = p.pmin}
+			display_error ctx (spack pack ^ " in " ^ file ^ " should be " ^ spack (fst m)) {p with pmax = p.pmin}
 	end;
 	file, if !remap <> fst m then
 		(* build typedefs to redirect to real package *)