Przeglądaj źródła

ignore return_partial_type if expression is EConst (closes #1956)

Simon Krajewski 12 lat temu
rodzic
commit
d0907e069f
1 zmienionych plików z 2 dodań i 1 usunięć
  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
 			in
 			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);
 					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);