Browse Source

ignore return_partial_type if expression is EConst (closes #1956)

Simon Krajewski 12 years ago
parent
commit
d0907e069f
1 changed files with 2 additions and 1 deletions
  1. 2 1
      typeload.ml

+ 2 - 1
typeload.ml

@@ -1404,7 +1404,8 @@ let init_class ctx c p context_init herits fields =
 				else e
 				else e
 			in
 			in
 			let r = exc_protect ctx (fun r ->
 			let r = exc_protect ctx (fun r ->
-				if not !return_partial_type then begin
+				(* type constant init fields (issue #1956) *)
+				if not !return_partial_type || (match fst e with EConst _ -> true | _ -> false) then begin
 					r := (fun() -> t);
 					r := (fun() -> t);
 					context_init();
 					context_init();
 					if ctx.com.verbose then Common.log ctx.com ("Typing " ^ (if ctx.in_macro then "macro " else "") ^ s_type_path c.cl_path ^ "." ^ cf.cf_name);
 					if ctx.com.verbose then Common.log ctx.com ("Typing " ^ (if ctx.in_macro then "macro " else "") ^ s_type_path c.cl_path ^ "." ^ cf.cf_name);