2
0
Эх сурвалжийг харах

[typer] allow importing private types of current module

for whatever reason
closes #9309
Simon Krajewski 5 жил өмнө
parent
commit
32d1ddca98

+ 1 - 1
src/typing/typeloadModule.ml

@@ -494,7 +494,7 @@ let init_module_type ctx context_init (decl,p) =
 			let types = md.m_types in
 			let no_private (t,_) = not (t_infos t).mt_private in
 			let error_private p = error "Importing private declarations from a module is not allowed" p in
-			let chk_private t p = if (t_infos t).mt_private then error_private p in
+			let chk_private t p = if ctx.m.curmod != (t_infos t).mt_module && (t_infos t).mt_private then error_private p in
 			let has_name name t = snd (t_infos t).mt_path = name in
 			let get_type tname =
 				let t = (try List.find (has_name tname) types with Not_found -> error (StringError.string_error tname (List.map (fun mt -> snd (t_infos mt).mt_path) types) ("Module " ^ s_type_path md.m_path ^ " does not define type " ^ tname)) p_type) in

+ 9 - 0
tests/unit/src/unit/issues/Issue9309.hx

@@ -0,0 +1,9 @@
+package unit.issues;
+
+import unit.issues.Issue9309.PrivateType;
+
+class Issue9309 extends Test {
+
+}
+
+private class PrivateType {}