2
0
Эх сурвалжийг харах

avoid more error messages in display mode

Simon Krajewski 9 жил өмнө
parent
commit
84bb0d8a08

+ 2 - 0
src/typing/matcher.ml

@@ -1249,6 +1249,7 @@ module TexprConverter = struct
 					with Not_exhaustive -> match with_type,finiteness with
 						| NoValue,Infinite -> None
 						| _,CompileTimeFinite when unmatched = [] -> None
+						| _ when ctx.com.display <> DMNone -> None
 						| _ -> report_not_exhaustive e_subject unmatched
 				in
 				let cases = ExtList.List.filter_map (fun (con,_,dt) -> match unify_constructor ctx params e_subject.etype con with
@@ -1321,6 +1322,7 @@ module TexprConverter = struct
 					)
 				with Not_exhaustive ->
 					if toplevel then (fun () -> loop false params dt2)
+					else if ctx.com.display <> DMNone then (fun () -> mk (TConst TNull) (mk_mono()) dt2.dt_pos)
 					else report_not_exhaustive e [ConConst TNull,dt.dt_pos]
 				in
 				f()

+ 4 - 1
src/typing/typeload.ml

@@ -1038,7 +1038,9 @@ let type_function_arg_value ctx t c =
 			let rec loop e = match e.eexpr with
 				| TConst c -> Some c
 				| TCast(e,None) -> loop e
-				| _ -> display_error ctx "Parameter default value should be constant" p; None
+				| _ ->
+					if ctx.com.display = DMNone then display_error ctx "Parameter default value should be constant" p;
+					None
 			in
 			loop e
 
@@ -1593,6 +1595,7 @@ let type_function ctx args ret fmode f do_display p =
 		   can _not_ use type_iseq to avoid the Void check above because that
 		   would turn Dynamic returns to Void returns. *)
 		| TMono t when not (has_return e) -> ignore(link t ret ctx.t.tvoid)
+		| _ when ctx.com.display <> DMNone -> ()
 		| _ -> (try return_flow ctx e with Exit -> ())
 	end;
 	let rec loop e =

+ 3 - 6
src/typing/typer.ml

@@ -1037,13 +1037,10 @@ let rec acc_get ctx g p =
 		let cmode = (match fmode with FStatic _ -> fmode | FInstance (c,tl,f) -> FClosure (Some (c,tl),f) | _ -> assert false) in
 		ignore(follow f.cf_type); (* force computing *)
 		(match f.cf_expr with
-		| None ->
-			if ctx.com.display <> DMNone then
-				mk (TField (e,cmode)) t p
-			else
-				error "Recursive inline is not supported" p
-		| Some _ when ctx.com.display <> DMNone ->
+		| _ when ctx.com.display <> DMNone ->
 			mk (TField (e,cmode)) t p
+		| None ->
+			error "Recursive inline is not supported" p
 		| Some { eexpr = TFunction _ } ->
 			let chk_class c = (c.cl_extern || Meta.has Meta.Extern f.cf_meta) && not (Meta.has Meta.Runtime f.cf_meta) in
 			let wrap_extern c =