Browse Source

[display] don't show non-static abstract fields via using (closes #6421)

Simon Krajewski 8 years ago
parent
commit
edd0ca5207
2 changed files with 22 additions and 1 deletions
  1. 1 1
      src/typing/typer.ml
  2. 21 0
      tests/display/src/cases/Issue6421.hx

+ 1 - 1
src/typing/typer.ml

@@ -3936,7 +3936,7 @@ and display_expr ctx e_ast e with_type p =
 				let acc = ref (loop acc l) in
 				let rec dup t = Type.map dup t in
 				List.iter (fun f ->
-					if not (Meta.has Meta.NoUsing f.cf_meta) then
+					if not (Meta.has Meta.NoUsing f.cf_meta) && not (Meta.has Meta.Impl f.cf_meta) then
 					let f = { f with cf_type = opt_type f.cf_type } in
 					let monos = List.map (fun _ -> mk_mono()) f.cf_params in
 					let map = apply_params f.cf_params monos in

+ 21 - 0
tests/display/src/cases/Issue6421.hx

@@ -0,0 +1,21 @@
+package cases;
+
+class Issue6421 extends DisplayTestCase {
+	/**
+	using cases.Issue6421.Abstract;
+
+	abstract Abstract(Int) {
+		public function new(i) this = i;
+		public function foo():Void { }
+	}
+
+	class Main {
+		static function main() {
+			0.{-1-}
+		}
+	}
+	**/
+	function test() {
+		eq(false, hasField(fields(pos(1)), "foo", "Void -> Void"));
+	}
+}