Selaa lähdekoodia

[display] ignore @:enum fields in completion

closes #7084
Simon Krajewski 7 vuotta sitten
vanhempi
commit
d83f6a4474
2 muutettua tiedostoa jossa 20 lisäystä ja 1 poistoa
  1. 1 1
      src/context/display/displayFields.ml
  2. 19 0
      tests/display/src/cases/Issue7084.hx

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

@@ -122,7 +122,7 @@ let collect ctx e_ast e dk with_type p =
 		| TAbstract({a_impl = Some c} as a,tl) ->
 		| TAbstract({a_impl = Some c} as a,tl) ->
 			(* Abstracts should show all their @:impl fields minus the constructor. *)
 			(* Abstracts should show all their @:impl fields minus the constructor. *)
 			let items = List.fold_left (fun acc cf ->
 			let items = List.fold_left (fun acc cf ->
-				if Meta.has Meta.Impl cf.cf_meta && should_access c cf false && is_new_item acc cf.cf_name then begin
+				if Meta.has Meta.Impl cf.cf_meta && not (Meta.has Meta.Enum cf.cf_meta) && should_access c cf false && is_new_item acc cf.cf_name then begin
 					let origin = Self(TAbstractDecl a) in
 					let origin = Self(TAbstractDecl a) in
 					let cf = prepare_using_field cf in
 					let cf = prepare_using_field cf in
 					let cf = if tl = [] then cf else {cf with cf_type = apply_params a.a_params tl cf.cf_type} in
 					let cf = if tl = [] then cf else {cf with cf_type = apply_params a.a_params tl cf.cf_type} in

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

@@ -0,0 +1,19 @@
+package cases;
+
+class Issue7084 extends DisplayTestCase {
+	/**
+	enum abstract Foo(Int) {
+		var Value = 0;
+	}
+
+	class Main {
+		public static function main() {
+			var f:Foo;
+			f.{-1-}
+		}
+	}
+	**/
+	function test() {
+		eq(0, fields(pos(1)).length);
+	}
+}