Просмотр исходного кода

[display] patch abstract implementation fields on type display

closes #6756
Simon Krajewski 7 лет назад
Родитель
Сommit
9878ed380d
2 измененных файлов с 19 добавлено и 1 удалено
  1. 7 1
      src/context/display.ml
  2. 12 0
      tests/display/src/cases/Issue6756.hx

+ 7 - 1
src/context/display.ml

@@ -172,7 +172,13 @@ module DisplayEmitter = struct
 	let display_field dm cf p = match dm.dms_kind with
 		| DMPosition -> raise (DisplayPosition [cf.cf_pos]);
 		| DMUsage _ -> cf.cf_meta <- (Meta.Usage,[],cf.cf_pos) :: cf.cf_meta;
-		| DMType -> raise (DisplayType (cf.cf_type,p,cf.cf_doc))
+		| DMType ->
+			let t = if Meta.has Meta.Impl cf.cf_meta then
+				(prepare_using_field cf).cf_type
+			else
+				cf.cf_type
+			in
+			raise (DisplayType (t,p,cf.cf_doc))
 		| _ -> ()
 
 	let maybe_display_field ctx p cf =

+ 12 - 0
tests/display/src/cases/Issue6756.hx

@@ -0,0 +1,12 @@
+package cases;
+
+class Issue6756 extends DisplayTestCase {
+	/**
+	abstract Result(String) {
+	    function f{-1-}oo() {}
+	}
+	**/
+	function test() {
+		eq("Void -> Void", type(pos(1)));
+	}
+}