Skip to content

Commit aa3ecc5

Browse files
authored
[typer] delay add_constructor (#12364)
* [typer] delay add_constructor * [tests] Add test for #12357
1 parent 320ace7 commit aa3ecc5

File tree

5 files changed

+12
-1
lines changed

5 files changed

+12
-1
lines changed

src/typing/typeloadFields.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1797,5 +1797,5 @@ let init_class ctx_c cctx c p herits fields =
17971797
end;
17981798
if not has_struct_init then
17991799
(* add_constructor does not deal with overloads correctly *)
1800-
if not com.config.pf_overload then TypeloadFunction.add_constructor ctx_c c cctx.force_constructor p;
1800+
if not com.config.pf_overload then delay_late ctx_c.g PConnectField (fun() -> TypeloadFunction.add_constructor ctx_c c cctx.force_constructor p);
18011801
finalize_class cctx
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-cp src
2+
-main Main
3+
-hl bin/dummy.hl
4+
--hxb bin/hxb.zip
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-cp src
2+
--hxb-lib bin/hxb.zip
3+
-main Main
4+
MyException
5+
-hl bin/dummy.hl
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
function main() {}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class MyException extends haxe.Exception {}

0 commit comments

Comments
 (0)