Переглянути джерело

[display] deal with `.bind`

closes #7171
Simon Krajewski 7 роки тому
батько
коміт
d11b3ee4c1
2 змінених файлів з 18 додано та 0 видалено
  1. 4 0
      src/typing/typerDisplay.ml
  2. 14 0
      tests/display/src/cases/Issue7171.hx

+ 4 - 0
src/typing/typerDisplay.ml

@@ -428,6 +428,10 @@ let handle_display ctx e_ast dk with_type =
 		timer();
 		raise_fields l CRNew p
 	in
+	let e = match e.eexpr with
+		| TField(e1,FDynamic "bind") when (match follow e1.etype with TFun _ -> true | _ -> false) -> e1
+		| _ -> e
+	in
 	let is_display_debug = Meta.has (Meta.Custom ":debug.display") ctx.curfield.cf_meta in
 	if is_display_debug then begin
 		print_endline (Printf.sprintf "expected type: %s" (s_with_type with_type));

+ 14 - 0
tests/display/src/cases/Issue7171.hx

@@ -0,0 +1,14 @@
+package cases;
+
+class Issue7171 extends DisplayTestCase {
+	/**
+	class Main {
+		static function main() {
+			Std.string.bi{-1-}nd(_);
+		}
+	}
+	**/
+	function test() {
+		eq("s : Dynamic -> String", type(pos(1)));
+	}
+}