Browse Source

[display] show private abstract fields in completion inside that abstract
fixes #8789

Aleksandr Kuzmenko 6 years ago
parent
commit
042a66d8c3
2 changed files with 7 additions and 2 deletions
  1. 2 1
      src/context/typecore.ml
  2. 5 1
      tests/display/src/cases/Issue8789.hx

+ 2 - 1
src/context/typecore.ml

@@ -382,8 +382,9 @@ let rec can_access ctx ?(in_overload=false) c cf stat =
 		true
 		true
 	else if not in_overload && ctx.com.config.pf_overload && Meta.has Meta.Overload cf.cf_meta then
 	else if not in_overload && ctx.com.config.pf_overload && Meta.has Meta.Overload cf.cf_meta then
 		true
 		true
+	else if c == ctx.curclass then
+		true
 	else
 	else
-	(* TODO: should we add a c == ctx.curclass short check here? *)
 	(* has metadata path *)
 	(* has metadata path *)
 	let rec make_path c f = match c.cl_kind with
 	let rec make_path c f = match c.cl_kind with
 		| KAbstractImpl a -> fst a.a_path @ [snd a.a_path; f.cf_name]
 		| KAbstractImpl a -> fst a.a_path @ [snd a.a_path; f.cf_name]

+ 5 - 1
tests/display/src/cases/Issue8789.hx

@@ -7,13 +7,17 @@ class Issue8789 extends DisplayTestCase {
 				this = value;
 				this = value;
 			}
 			}
 
 
+			inline function pvt() {}
+
 			public function test() {
 			public function test() {
-				new Int8{-1-}(10);
+				var i = new Int8{-1-}(10);
+				i.{-2-}
 			}
 			}
 		}
 		}
 	**/
 	**/
 	function test() {
 	function test() {
 		var r = toplevel(pos(1));
 		var r = toplevel(pos(1));
 		eq(true, hasToplevel(r, "type", "Int8"));
 		eq(true, hasToplevel(r, "type", "Int8"));
+		eq(true, hasField(fields(pos(2)), "pvt", "Void -> Void"));
 	}
 	}
 }
 }