|
@@ -1421,6 +1421,9 @@ let init_class ctx c p context_init herits fields =
|
|
(*
|
|
(*
|
|
make sure a default contructor with same access as super one will be added to the class structure at some point.
|
|
make sure a default contructor with same access as super one will be added to the class structure at some point.
|
|
*)
|
|
*)
|
|
|
|
+ let has_struct_init = Meta.has Meta.StructInit c.cl_meta in
|
|
|
|
+ if has_struct_init then
|
|
|
|
+ ensure_struct_init_constructor ctx c fields p;
|
|
begin match cctx.uninitialized_final with
|
|
begin match cctx.uninitialized_final with
|
|
| Some pf when c.cl_constructor = None ->
|
|
| Some pf when c.cl_constructor = None ->
|
|
display_error ctx "This class has uninitialized final vars, which requires a constructor" p;
|
|
display_error ctx "This class has uninitialized final vars, which requires a constructor" p;
|
|
@@ -1428,9 +1431,7 @@ let init_class ctx c p context_init herits fields =
|
|
| _ ->
|
|
| _ ->
|
|
()
|
|
()
|
|
end;
|
|
end;
|
|
- if Meta.has Meta.StructInit c.cl_meta then
|
|
|
|
- ensure_struct_init_constructor ctx c fields p
|
|
|
|
- else
|
|
|
|
|
|
+ if not has_struct_init then
|
|
(* add_constructor does not deal with overloads correctly *)
|
|
(* add_constructor does not deal with overloads correctly *)
|
|
if not ctx.com.config.pf_overload then TypeloadFunction.add_constructor ctx c cctx.force_constructor p;
|
|
if not ctx.com.config.pf_overload then TypeloadFunction.add_constructor ctx c cctx.force_constructor p;
|
|
(* check overloaded constructors *)
|
|
(* check overloaded constructors *)
|