Kaynağa Gözat

fix more special display cases (closes #5614)

Simon Krajewski 9 yıl önce
ebeveyn
işleme
961a5dab40
2 değiştirilmiş dosya ile 5 ekleme ve 1 silme
  1. 3 1
      src/main.ml
  2. 2 0
      src/typing/typer.ml

+ 3 - 1
src/main.ml

@@ -1782,7 +1782,9 @@ with
 		let ctx = print_context() in
 		let b = Buffer.create 0 in
 		List.iter (fun (t,doc) ->
-			Buffer.add_string b "<type>\n";
+			Buffer.add_string b "<type";
+			Option.may (fun s -> Buffer.add_string b (Printf.sprintf " d=\"%s\"" (htmlescape s))) doc;
+			Buffer.add_string b ">\n";
 			Buffer.add_string b (htmlescape (s_type ctx (follow t)));
 			Buffer.add_string b "\n</type>\n";
 		) tl;

+ 2 - 0
src/typing/typer.ml

@@ -3846,6 +3846,8 @@ and handle_display ctx e_ast iscall with_type =
 		| EConst (Ident "$type"),_ ->
 			let mono = mk_mono() in
 			raise (Display.DisplaySignatures [(TFun(["expression",false,mono],mono),Some "Outputs type of argument as a warning and uses argument as value")])
+		| EConst (Ident "trace"),_ ->
+			raise (Display.DisplaySignatures [(tfun [t_dynamic] ctx.com.basic.tvoid,Some "Print given arguments")])
 		| _ -> ()
 	end;
 	let e = try