Przeglądaj źródła

[typer] allow private access to own module statics

closes #9777
Simon Krajewski 5 lat temu
rodzic
commit
4e3ae22b4d
2 zmienionych plików z 15 dodań i 1 usunięć
  1. 4 1
      src/context/typecore.ml
  2. 11 0
      tests/unit/src/unit/issues/Issue9777.hx

+ 4 - 1
src/context/typecore.ml

@@ -456,7 +456,10 @@ let rec can_access ctx c cf stat =
 		true
 	else if c == ctx.curclass then
 		true
-	else
+	else match ctx.m.curmod.m_statics with
+		| Some c' when c == c' ->
+			true
+		| _ ->
 	(* has metadata path *)
 	let rec make_path c f = match c.cl_kind with
 		| KAbstractImpl a -> fst a.a_path @ [snd a.a_path; f.cf_name]

+ 11 - 0
tests/unit/src/unit/issues/Issue9777.hx

@@ -0,0 +1,11 @@
+package unit.issues;
+
+private function g() {
+	return true;
+}
+
+class Issue9777 extends unit.Test {
+	function test() {
+		t(g());
+	}
+}