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

mark display as handled so we don't do field display as well

Simon Krajewski 9 жил өмнө
parent
commit
f948011e70

+ 3 - 1
src/typing/typeload.ml

@@ -1547,8 +1547,10 @@ let type_function ctx args ret fmode f do_display p =
 		let c = type_function_arg_value ctx t c in
 		let c = type_function_arg_value ctx t c in
 		let v,c = add_local ctx n t pn, c in
 		let v,c = add_local ctx n t pn, c in
 		v.v_meta <- m;
 		v.v_meta <- m;
-		if do_display && Display.encloses_position !Parser.resume_display pn then
+		if do_display && Display.encloses_position !Parser.resume_display pn then begin
+			ctx.display_handled <- true;
 			Display.display_variable ctx.com.display v;
 			Display.display_variable ctx.com.display v;
+		end;
 		if n = "this" then v.v_meta <- (Meta.This,[],p) :: v.v_meta;
 		if n = "this" then v.v_meta <- (Meta.This,[],p) :: v.v_meta;
 		v,c
 		v,c
 	) args f.f_args in
 	) args f.f_args in

+ 6 - 2
src/typing/typer.ml

@@ -2829,8 +2829,10 @@ and type_vars ctx vl p =
 			) in
 			) in
 			if v.[0] = '$' && ctx.com.display = DMNone then error "Variables names starting with a dollar are not allowed" p;
 			if v.[0] = '$' && ctx.com.display = DMNone then error "Variables names starting with a dollar are not allowed" p;
 			let v,e = add_local ctx v t pv, e in
 			let v,e = add_local ctx v t pv, e in
-			if Display.is_display_position pv then
+			if Display.is_display_position pv then begin
+				ctx.display_handled <- true;
 				Display.display_variable ctx.com.display v;
 				Display.display_variable ctx.com.display v;
+			end;
 			v,e
 			v,e
 		with
 		with
 			Error (e,p) ->
 			Error (e,p) ->
@@ -3224,8 +3226,10 @@ and type_try ctx e1 catches with_type p =
 		check_unreachable acc t2 (pos e);
 		check_unreachable acc t2 (pos e);
 		let locals = save_locals ctx in
 		let locals = save_locals ctx in
 		let v = add_local ctx v t pv in
 		let v = add_local ctx v t pv in
-		if Display.is_display_position pv then
+		if Display.is_display_position pv then begin
+			ctx.display_handled <- true;
 			Display.display_variable ctx.com.display v;
 			Display.display_variable ctx.com.display v;
+		end;
 		let e = type_expr ctx e with_type in
 		let e = type_expr ctx e with_type in
 		v.v_type <- t2;
 		v.v_type <- t2;
 		locals();
 		locals();