From 4039baabdd3a88cb7f9d968620e10bbc11960f8b Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Fri, 23 Feb 2024 09:48:00 +0100 Subject: [PATCH] Add missing space, add unit tests --- src/generators/hlopt.ml | 2 +- tests/unit/src/unit/issues/Issue11466.hx | 14 ++++++++++++++ tests/unit/src/unit/issues/Issue9174.hx | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/unit/src/unit/issues/Issue11466.hx create mode 100644 tests/unit/src/unit/issues/Issue9174.hx diff --git a/src/generators/hlopt.ml b/src/generators/hlopt.ml index 9fd60e1b9ab..30f8e9a6d04 100644 --- a/src/generators/hlopt.ml +++ b/src/generators/hlopt.ml @@ -482,7 +482,7 @@ let code_graph (f:fundecl) = } in Hashtbl.add blocks_pos pos b; let rec loop i = - let goto ?(tl=b.btrap) d= + let goto ?(tl=b.btrap) d = let b2 = make_block tl (i + 1 + d) in b2.bprev <- b :: b2.bprev; b2 diff --git a/tests/unit/src/unit/issues/Issue11466.hx b/tests/unit/src/unit/issues/Issue11466.hx new file mode 100644 index 00000000000..455995468c6 --- /dev/null +++ b/tests/unit/src/unit/issues/Issue11466.hx @@ -0,0 +1,14 @@ +package unit.issues; + +class Issue11466 extends unit.Test { + var b = 10; + function test() { + var x = 0; + try { + x = b; + throw "hi"; + }catch(_) { + eq(b, x); + } + } +} diff --git a/tests/unit/src/unit/issues/Issue9174.hx b/tests/unit/src/unit/issues/Issue9174.hx new file mode 100644 index 00000000000..c55d1f2a0f9 --- /dev/null +++ b/tests/unit/src/unit/issues/Issue9174.hx @@ -0,0 +1,18 @@ +package unit.issues; + +class Issue9174 extends unit.Test { + function test() { + var value = false; + try { + try { + throw ''; + } catch(e:String) { + value = true; + t(value); + throw e; + } + } catch(e:String) { + t(value); + } + } +}