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

[display] don't show enum abstract constructors of self

closes #8396
Simon Krajewski 6 жил өмнө
parent
commit
14679d7e60

+ 1 - 1
src/context/display/displayToplevel.ml

@@ -253,7 +253,7 @@ let collect ctx tk with_type =
 		(* enum constructors *)
 		let rec enum_ctors t =
 			match t with
-			| TAbstractDecl ({a_impl = Some c} as a) when Meta.has Meta.Enum a.a_meta && not (path_exists cctx a.a_path) ->
+			| TAbstractDecl ({a_impl = Some c} as a) when Meta.has Meta.Enum a.a_meta && not (path_exists cctx a.a_path) && ctx.curclass != c ->
 				add_path cctx a.a_path;
 				List.iter (fun cf ->
 					let ccf = CompletionClassField.make cf CFSMember (Self (decl_of_class c)) true in

+ 19 - 0
tests/display/src/cases/Issue8396.hx

@@ -0,0 +1,19 @@
+package cases;
+
+class Issue8396 extends DisplayTestCase {
+	/**
+		enum abstract Test(String) {
+			var Foo;
+			var Bar;
+
+			function foobar() {
+				{-1-}
+			}
+		}
+	**/
+	function test() {
+		var r = toplevel(pos(1));
+		eq(true, hasToplevel(r, "member", "Bar"));
+		eq(false, hasToplevel(r, "enumabstract", "Bar"));
+	}
+}