Browse Source

If dir should be renamed via com.package_rules do not forget to look for modules in original dir too (fixes #5921) (#5922)

Alexander Kuzmenko 8 years ago
parent
commit
10609a0d05
1 changed files with 10 additions and 4 deletions
  1. 10 4
      src/typing/typeload.ml

+ 10 - 4
src/typing/typeload.ml

@@ -3511,19 +3511,25 @@ let type_module ctx mpath file ?(is_extern=false) tdecls p =
 
 
 let resolve_module_file com m remap p =
 let resolve_module_file com m remap p =
 	let forbid = ref false in
 	let forbid = ref false in
-	let file = (match m with
+	let compose_path no_rename =
+		(match m with
 		| [] , name -> name
 		| [] , name -> name
 		| x :: l , name ->
 		| x :: l , name ->
 			let x = (try
 			let x = (try
 				match PMap.find x com.package_rules with
 				match PMap.find x com.package_rules with
 				| Forbidden -> forbid := true; x
 				| Forbidden -> forbid := true; x
-				| Directory d -> d
+				| Directory d -> if no_rename then x else d
 				| Remap d -> remap := d :: l; d
 				| Remap d -> remap := d :: l; d
 				with Not_found -> x
 				with Not_found -> x
 			) in
 			) in
 			String.concat "/" (x :: l) ^ "/" ^ name
 			String.concat "/" (x :: l) ^ "/" ^ name
-	) ^ ".hx" in
-	let file = Common.find_file com file in
+		) ^ ".hx"
+	in
+	let file = try
+			Common.find_file com (compose_path false)
+		with Not_found ->
+			Common.find_file com (compose_path true)
+	in
 	let file = (match String.lowercase (snd m) with
 	let file = (match String.lowercase (snd m) with
 	| "con" | "aux" | "prn" | "nul" | "com1" | "com2" | "com3" | "lpt1" | "lpt2" | "lpt3" when Sys.os_type = "Win32" ->
 	| "con" | "aux" | "prn" | "nul" | "com1" | "com2" | "com3" | "lpt1" | "lpt2" | "lpt3" when Sys.os_type = "Win32" ->
 		(* these names are reserved by the OS - old DOS legacy, such files cannot be easily created but are reported as visible *)
 		(* these names are reserved by the OS - old DOS legacy, such files cannot be easily created but are reported as visible *)