Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floats let bindings #76

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions backend-es/test/snapshots-out/Snapshot.EffectBind01.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import * as Effect$dConsole from "../Effect.Console/index.js";
const test1 = /* #__PURE__ */ (() => {
const $0 = Effect$dConsole.log("1");
return () => {
$0();
const value = Effect$dConsole.log("2")();
Effect$dConsole.log("3")();
return value;
};
})();
export {test1};
const test1$0 = /* #__PURE__ */ Effect$dConsole.log("1");
const test1 = () => {
test1$0();
const value = Effect$dConsole.log("2")();
Effect$dConsole.log("3")();
return value;
};
export {test1, test1$0};
30 changes: 30 additions & 0 deletions backend-es/test/snapshots-out/Snapshot.FloatLetFromApp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import * as $runtime from "../runtime.js";
import * as Data$dEither from "../Data.Either/index.js";
import * as Data$dFoldable from "../Data.Foldable/index.js";
import * as Data$dTuple from "../Data.Tuple/index.js";
import * as Effect$dConsole from "../Effect.Console/index.js";
const test1$0$b = /* #__PURE__ */ Effect$dConsole.log("foo");
const test1$1$a = /* #__PURE__ */ Data$dFoldable.foldlArray(a => b => {
if (a.tag === "Left") { return Data$dEither.$Either("Left", a._1); }
if (a.tag === "Right") {
if (b.tag === "Left") { return Data$dEither.$Either("Left", b._1); }
if (b.tag === "Right") { return Data$dEither.$Either("Right", a._1 + b._1 | 0); }
}
$runtime.fail();
})(/* #__PURE__ */ Data$dEither.$Either("Right", 3))([
/* #__PURE__ */ Data$dEither.$Either("Left", test1$0$b),
/* #__PURE__ */ Data$dEither.$Either("Right", 4),
/* #__PURE__ */ Data$dEither.$Either("Left", test1$0$b)
]);
const test1 = /* #__PURE__ */ Data$dTuple.$Tuple(
1,
/* #__PURE__ */ Data$dTuple.$Tuple(
test1$1$a,
/* #__PURE__ */ (() => {
if (test1$1$a.tag === "Left") { return Data$dEither.$Either("Left", test1$1$a._1); }
if (test1$1$a.tag === "Right") { return Data$dEither.$Either("Right", test1$1$a._1 + 1 | 0); }
$runtime.fail();
})()
)
);
export {test1, test1$0$b, test1$1$a};
37 changes: 37 additions & 0 deletions backend-es/test/snapshots-out/Snapshot.FloatLetFromArray.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as $runtime from "../runtime.js";
import * as Data$dEither from "../Data.Either/index.js";
import * as Effect$dConsole from "../Effect.Console/index.js";
const snd = a => a[1];
const right = x => {
if (x.tag === "Right") { return x._1; }
$runtime.fail();
};
const left = x => {
if (x.tag === "Left") { return x._1; }
$runtime.fail();
};
const fst = a => a[0];
const test1$0$b = /* #__PURE__ */ Effect$dConsole.log("foo");
const test1 = [
/* #__PURE__ */ Data$dEither.$Either("Left", 5),
/* #__PURE__ */ Data$dEither.$Either(
"Right",
[
/* #__PURE__ */ Data$dEither.$Either(
"Left",
[
/* #__PURE__ */ Data$dEither.$Either("Left", 1),
/* #__PURE__ */ Data$dEither.$Either(
"Right",
[
/* #__PURE__ */ Data$dEither.$Either("Left", test1$0$b),
/* #__PURE__ */ Data$dEither.$Either("Right", [/* #__PURE__ */ Data$dEither.$Either("Left", 5), /* #__PURE__ */ Data$dEither.$Either("Right", test1$0$b)])
]
)
]
),
/* #__PURE__ */ Data$dEither.$Either("Right", 6)
]
)
];
export {fst, left, right, snd, test1, test1$0$b};
8 changes: 8 additions & 0 deletions backend-es/test/snapshots-out/Snapshot.FloatLetFromCtor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Data$dTuple from "../Data.Tuple/index.js";
import * as Effect$dConsole from "../Effect.Console/index.js";
const test1$0$b = /* #__PURE__ */ Effect$dConsole.log("foo");
const test1 = /* #__PURE__ */ Data$dTuple.$Tuple(
5,
/* #__PURE__ */ Data$dTuple.$Tuple(/* #__PURE__ */ Data$dTuple.$Tuple(1, /* #__PURE__ */ Data$dTuple.$Tuple(test1$0$b, /* #__PURE__ */ Data$dTuple.$Tuple(5, test1$0$b))), 6)
);
export {test1, test1$0$b};
4 changes: 4 additions & 0 deletions backend-es/test/snapshots-out/Snapshot.FloatLetFromRecord.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as Effect$dConsole from "../Effect.Console/index.js";
const test1$0$b = /* #__PURE__ */ Effect$dConsole.log("foo");
const test1 = {l: 5, r: {l: {l: 1, r: {l: test1$0$b, r: {l: 5, r: test1$0$b}}}, r: 6}};
export {test1, test1$0$b};
18 changes: 9 additions & 9 deletions backend-es/test/snapshots-out/Snapshot.FunctionCompose03.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const test4 = f => g => {
const $0 = g();
const $1 = f();
const $2 = g();
const $3 = f();
const $2 = f();
const $3 = g();
Comment on lines +4 to +5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still find this odd that these definitions are being swapped around. I'm not sure if that's incorrect, it just seems like a strange artifact. Do you have any idea what is happening here? It may be easier to tell if all the invocations were different functions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure things are correct & then I'll respond to the point about why this is happening:

In the old one, 0 == g, 1 == f, 2 == g, 3 == f, 4 == g, so the final result of 0,1,2,3,4 was g,f,g,f,g.
In the current one, 0 == g, 1 == f, 2 == f, 3 == g, 4 == f, so the final result of 0,2,3,1,4 is g, f, g, f, g.

So it's correct, but as to why it's happening, I don't know.

Here's the trace from the new one:

== Snapshot.FunctionCompose03 ==================================================
================================================================================

++ Snapshot.FunctionCompose03.test4 Step 1 (Original) ++++++++++++++++++++++++++
  \f@0 g@1 ->
    Snapshot.FunctionCompose03.compose
      ( Snapshot.FunctionCompose03.compose
        ( Snapshot.FunctionCompose03.compose
          (g@1 Data.Unit.unit)
          (f@0 Data.Unit.unit)
        )
        (g@1 Data.Unit.unit)
      )
      ( Snapshot.FunctionCompose03.compose
        (f@0 Data.Unit.unit)
        (g@1 Data.Unit.unit)
      )

-- Snapshot.FunctionCompose03.test4 Step 2 -------------------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = f@0 #[prim.undefined] in
    {- Inline -}
    let @5 = \x@5 -> @2 (@4 x@5) in
    {- Inline -}
    let
      @6 =
        let
          @6 =
            {- Inline -}
            let
              @6 =
                let @6 = g@1 #[prim.undefined] in
                \x@7 -> @5 (@6 x@7) in
            @6 in
        let @7 = g@1 #[prim.undefined] in
        {- Inline -}
        let @8 = \x@8 -> @3 (@7 x@8) in
        \x@9 -> @6 (@8 x@9) in
    @6

-- Snapshot.FunctionCompose03.test4 Step 3 -------------------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = f@0 #[prim.undefined] in
    let @5 = g@1 #[prim.undefined] in
    {- Inline -}
    let
      @6 =
        \x@6 ->
          {- Inline -}
          let @7 = @5 x@6 in
          @2 (@4 @7) in
    let @7 = g@1 #[prim.undefined] in
    \x@8 -> @6 (@3 (@7 x@8))

-- Snapshot.FunctionCompose03.test4 Step 4 -------------------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = f@0 #[prim.undefined] in
    let @5 = g@1 #[prim.undefined] in
    let @6 = g@1 #[prim.undefined] in
    \x@7 ->
      {- Inline -}
      let @8 = @3 (@6 x@7) in
      @2 (@4 (@5 @8))

-- Snapshot.FunctionCompose03.test4 Step 5 (Final) -----------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = f@0 #[prim.undefined] in
    let @5 = g@1 #[prim.undefined] in
    let @6 = g@1 #[prim.undefined] in
    \x@7 -> @2 (@4 (@5 (@3 (@6 x@7))))

and here's the old one:

== Snapshot.FunctionCompose03 ==================================================
================================================================================

++ Snapshot.FunctionCompose03.test4 Step 1 (Original) ++++++++++++++++++++++++++
  \f@0 g@1 ->
    Snapshot.FunctionCompose03.compose
      ( Snapshot.FunctionCompose03.compose
        ( Snapshot.FunctionCompose03.compose
          (g@1 Data.Unit.unit)
          (f@0 Data.Unit.unit)
        )
        (g@1 Data.Unit.unit)
      )
      ( Snapshot.FunctionCompose03.compose
        (f@0 Data.Unit.unit)
        (g@1 Data.Unit.unit)
      )

-- Snapshot.FunctionCompose03.test4 Step 2 -------------------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    {- Inline -}
    let @4 = \x@4 -> @2 (@3 x@4) in
    let
      @5 =
        {- Inline -}
        let
          @5 =
            let @5 = g@1 #[prim.undefined] in
            \x@6 -> @4 (@5 x@6) in
        @5 in
    {- Inline -}
    let
      @6 =
        let @6 = f@0 #[prim.undefined] in
        let
          @7 =
            let @7 = g@1 #[prim.undefined] in
            {- Inline -}
            let @8 = \x@8 -> @6 (@7 x@8) in
            @8 in
        \x@8 -> @5 (@7 x@8) in
    @6

-- Snapshot.FunctionCompose03.test4 Step 3 -------------------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = g@1 #[prim.undefined] in
    {- Inline -}
    let
      @5 =
        \x@5 ->
          {- Inline -}
          let @6 = @4 x@5 in
          @2 (@3 @6) in
    let @6 = f@0 #[prim.undefined] in
    let @7 = g@1 #[prim.undefined] in
    {- Inline -}
    let @8 = \x@8 -> @6 (@7 x@8) in
    \x@9 -> @5 (@8 x@9)

-- Snapshot.FunctionCompose03.test4 Step 4 -------------------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = g@1 #[prim.undefined] in
    let @5 = f@0 #[prim.undefined] in
    let @6 = g@1 #[prim.undefined] in
    \x@7 ->
      {- Inline -}
      let @8 = @5 (@6 x@7) in
      @2 (@3 (@4 @8))

-- Snapshot.FunctionCompose03.test4 Step 5 (Final) -----------------------------
  \f@0 g@1 ->
    let @2 = g@1 #[prim.undefined] in
    let @3 = f@0 #[prim.undefined] in
    let @4 = g@1 #[prim.undefined] in
    let @5 = f@0 #[prim.undefined] in
    let @6 = g@1 #[prim.undefined] in
    \x@7 -> @2 (@3 (@4 (@5 (@6 x@7))))

Just reading through those, I can't figure out exactly what's going on yet.

Copy link
Collaborator

@natefaubion natefaubion Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's odd to me that in Step 2 there are a bunch of left-associative binds (level 6). I wouldn't expect that to happen since eval should be reassociating all binds. It looks like this is happening in the second case as well though.

const $4 = g();
return x => $0($1($2($3($4(x)))));
return x => $0($2($3($1($4(x)))));
};
const test3 = f => g => {
const $0 = f();
const $1 = g();
const $2 = f();
const $1 = f();
const $2 = g();
const $3 = g();
return x => $0($1($2($3(x))));
return x => $0($2($1($3(x))));
};
const test2 = f => g => {
const $0 = g();
const $1 = f();
const $0 = f();
const $1 = g();
const $2 = g();
return x => $0($1($2(x)));
return x => $1($0($2(x)));
};
const test1 = f => g => {
const $0 = f();
Expand Down
8 changes: 4 additions & 4 deletions backend-es/test/snapshots-out/Snapshot.Fusion01.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as Data$dShow from "../Data.Show/index.js";
import * as Data$dString$dCodeUnits from "../Data.String.CodeUnits/index.js";
import * as Data$dUnfoldable from "../Data.Unfoldable/index.js";
const toUnfoldable = /* #__PURE__ */ Data$dList.toUnfoldable(Data$dUnfoldable.unfoldableArray);
const test = x => Data$dArray.reverse(toUnfoldable((() => {
const test = x => {
const loop = loop$a0$copy => loop$a1$copy => {
let loop$a0 = loop$a0$copy, loop$a1 = loop$a1$copy, loop$c = true, loop$r;
while (loop$c) {
Expand All @@ -17,9 +17,9 @@ const test = x => Data$dArray.reverse(toUnfoldable((() => {
loop$r = acc;
continue;
}
const v1 = Data$dString$dCodeUnits.stripPrefix("1")(Data$dShow.showIntImpl(1 + x[n] | 0));
loop$a0 = n - 1 | 0;
loop$a1 = (() => {
const v1 = Data$dString$dCodeUnits.stripPrefix("1")(Data$dShow.showIntImpl(1 + x[n] | 0));
if (v1.tag === "Just") {
const $0 = "2" + v1._1;
if ($0 !== "wat") { return Data$dList$dTypes.$List("Cons", $0 + "1", acc); }
Expand All @@ -31,6 +31,6 @@ const test = x => Data$dArray.reverse(toUnfoldable((() => {
}
return loop$r;
};
return loop(x.length - 1 | 0)(Data$dList$dTypes.Nil);
})()));
return Data$dArray.reverse(toUnfoldable(loop(x.length - 1 | 0)(Data$dList$dTypes.Nil)));
};
export {test, toUnfoldable};
8 changes: 3 additions & 5 deletions backend-es/test/snapshots-out/Snapshot.Heterogeneous01.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
// @inline Heterogeneous.Mapping.mapRecordWithIndexCons arity=5
// @inline Heterogeneous.Mapping.mapRecordWithIndexNil.mapRecordWithIndexBuilder arity=2
import * as Data$dTuple from "../Data.Tuple/index.js";
const test2 = /* #__PURE__ */ (() => {
const $0 = Data$dTuple.Tuple("bar");
return r1 => ({...r1, a: 1 + r1.a | 0, b: $0(r1.b), c: !r1.c});
})();
const test2$0 = /* #__PURE__ */ Data$dTuple.Tuple("bar");
const test2 = r1 => ({...r1, a: 1 + r1.a | 0, b: test2$0(r1.b), c: !r1.c});
const test1 = {a: 13, b: /* #__PURE__ */ Data$dTuple.$Tuple("bar", 42.0), c: false};
export {test1, test2};
export {test1, test2, test2$0};
16 changes: 5 additions & 11 deletions backend-es/test/snapshots-out/Snapshot.Html.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
const $Html = (tag, _1, _2) => ({tag, _1, _2});
const Elem = value0 => value1 => $Html("Elem", value0, value1);
const Text = value0 => $Html("Text", value0);
const h11 = /* #__PURE__ */ (() => {
const $0 = Elem("h1");
return x => $0([x]);
})();
const h21 = /* #__PURE__ */ (() => {
const $0 = Elem("h2");
return x => $0([x]);
})();
const h11$0 = /* #__PURE__ */ Elem("h1");
const h21$0 = /* #__PURE__ */ Elem("h2");
const p1 = /* #__PURE__ */ Elem("p");
const section1 = /* #__PURE__ */ Elem("section");
const article1 = /* #__PURE__ */ Elem("article");
const test = user => section1([
h11($Html("Text", "Posts for " + user)),
article1([h21($Html("Text", "The first post")), p1([$Html("Text", "This is the first post."), $Html("Text", "Not much else to say.")])])
h11$0([$Html("Text", "Posts for " + user)]),
article1([h21$0([$Html("Text", "The first post")]), p1([$Html("Text", "This is the first post."), $Html("Text", "Not much else to say.")])])
]);
export {$Html, Elem, Text, article1, h11, h21, p1, section1, test};
export {$Html, Elem, Text, article1, h11$0, h21$0, p1, section1, test};
22 changes: 10 additions & 12 deletions backend-es/test/snapshots-out/Snapshot.InlineArrayIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ const testArrayIndex = arr => ix => {
if (ix >= 0 && ix < arr.length) { return Data$dMaybe.$Maybe("Just", arr[ix]); }
return Data$dMaybe.Nothing;
};
const main = /* #__PURE__ */ (() => {
const array = [1, 2, 3];
const $0 = assertEqual("index -1")({expected: Data$dMaybe.Nothing, actual: testArrayIndex(array)(-1)});
return () => {
$0();
assertEqual("index 0")({expected: Data$dMaybe.$Maybe("Just", 1), actual: testArrayIndex(array)(0)})();
assertEqual("index 1")({expected: Data$dMaybe.$Maybe("Just", 2), actual: testArrayIndex(array)(1)})();
assertEqual("index 2")({expected: Data$dMaybe.$Maybe("Just", 3), actual: testArrayIndex(array)(2)})();
return assertEqual("index 3")({expected: Data$dMaybe.Nothing, actual: testArrayIndex(array)(3)})();
};
})();
export {assertEqual, main, testArrayIndex};
const main$0$array = [1, 2, 3];
const main$1 = /* #__PURE__ */ assertEqual("index -1")({expected: Data$dMaybe.Nothing, actual: /* #__PURE__ */ testArrayIndex(main$0$array)(-1)});
const main = () => {
main$1();
assertEqual("index 0")({expected: Data$dMaybe.$Maybe("Just", 1), actual: testArrayIndex(main$0$array)(0)})();
assertEqual("index 1")({expected: Data$dMaybe.$Maybe("Just", 2), actual: testArrayIndex(main$0$array)(1)})();
assertEqual("index 2")({expected: Data$dMaybe.$Maybe("Just", 3), actual: testArrayIndex(main$0$array)(2)})();
return assertEqual("index 3")({expected: Data$dMaybe.Nothing, actual: testArrayIndex(main$0$array)(3)})();
};
export {assertEqual, main, main$0$array, main$1, testArrayIndex};
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
import * as Type$dEquality from "../Type.Equality/index.js";
const wat = dict => dict.wat;
const testImpl = x => x;
const watUnit = dictTypeEquals => (
{
wat: (() => {
const $0 = dictTypeEquals.proof(a => a);
return x => testImpl($0(x));
})()
}
);
const watUnit = dictTypeEquals => {
const $0 = dictTypeEquals.proof(a => a);
return {wat: x => testImpl($0(x))};
};
const wat1 = /* #__PURE__ */ (() => watUnit(Type$dEquality.refl).wat)();
const g = wat1;
const test2 = /* #__PURE__ */ testImpl();
Expand Down
16 changes: 7 additions & 9 deletions backend-es/test/snapshots-out/Snapshot.PrimOpIntDiv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ import * as Assert from "../Assert/index.js";
import * as Data$dEq from "../Data.Eq/index.js";
import * as Data$dShow from "../Data.Show/index.js";
const divNoInline = a => b => $runtime.intDiv(a, b);
const main = /* #__PURE__ */ (() => {
const $0 = Assert.assertEqual(Data$dEq.eqInt)(Data$dShow.showInt)("div1")({expected: 0, actual: divNoInline(1)(0)});
return () => {
$0();
Assert.assertEqual(Data$dEq.eqInt)(Data$dShow.showInt)("div2")({expected: 1, actual: divNoInline(3)(2)})();
return Assert.assertEqual(Data$dEq.eqInt)(Data$dShow.showInt)("div3")({expected: -1, actual: divNoInline(3)(-2)})();
};
})();
export {divNoInline, main};
const main$0 = /* #__PURE__ */ Assert.assertEqual(Data$dEq.eqInt)(Data$dShow.showInt)("div1")({expected: 0, actual: /* #__PURE__ */ divNoInline(1)(0)});
const main = () => {
main$0();
Assert.assertEqual(Data$dEq.eqInt)(Data$dShow.showInt)("div2")({expected: 1, actual: divNoInline(3)(2)})();
return Assert.assertEqual(Data$dEq.eqInt)(Data$dShow.showInt)("div3")({expected: -1, actual: divNoInline(3)(-2)})();
};
export {divNoInline, main, main$0};
30 changes: 12 additions & 18 deletions backend-es/test/snapshots-out/Snapshot.RecursionSchemes01.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@ const functorExprF = {
$runtime.fail();
}
};
const test1 = /* #__PURE__ */ (() => {
const go = v => {
if (v.tag === "Add") { return go(v._1) + go(v._2) | 0; }
if (v.tag === "Mul") { return go(v._1) * go(v._2) | 0; }
if (v.tag === "Lit") { return v._1; }
$runtime.fail();
};
return go;
})();
const test2 = /* #__PURE__ */ (() => {
const go = v => {
if (v.tag === "Add") { return go(v._1) + go(v._2) | 0; }
if (v.tag === "Mul") { return go(v._1) * go(v._2) | 0; }
if (v.tag === "Lit") { return v._1 + 1 | 0; }
$runtime.fail();
};
return go;
})();
const test1 = v => {
if (v.tag === "Add") { return test1(v._1) + test1(v._2) | 0; }
if (v.tag === "Mul") { return test1(v._1) * test1(v._2) | 0; }
if (v.tag === "Lit") { return v._1; }
$runtime.fail();
};
const test2 = v => {
if (v.tag === "Add") { return test2(v._1) + test2(v._2) | 0; }
if (v.tag === "Mul") { return test2(v._1) * test2(v._2) | 0; }
if (v.tag === "Lit") { return v._1 + 1 | 0; }
$runtime.fail();
};
export {$ExprF, Add, Lit, Mul, functorExprF, test1, test2};
22 changes: 10 additions & 12 deletions backend-es/test/snapshots-out/Snapshot.RecursiveBindingGroup02.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// @fails Binding demanded before initialized
import * as $runtime from "../runtime.js";
const test = /* #__PURE__ */ (() => {
const test3 = n => {
if (n < 100) { return n; }
return test1$lazy().bar;
};
const test2$lazy = $runtime.binding(() => ({baz: test1$lazy().bar}));
const test1$lazy = $runtime.binding(() => ({foo: test2$lazy().baz, bar: test3(42)}));
const test2 = test2$lazy();
const test1 = test1$lazy();
return test1.bar;
})();
export {test};
const test$0$test3$$rec = n => {
if (n < 100) { return n; }
return test$0$test1$$rec$lazy().bar;
};
const test$0$test2$$rec$lazy = /* #__PURE__ */ $runtime.binding(() => ({baz: test$0$test1$$rec$lazy().bar}));
const test$0$test1$$rec$lazy = /* #__PURE__ */ $runtime.binding(() => ({foo: test$0$test2$$rec$lazy().baz, bar: test$0$test3$$rec(42)}));
const test$0$test2$$rec = /* #__PURE__ */ test$0$test2$$rec$lazy();
const test$0$test1$$rec = /* #__PURE__ */ test$0$test1$$rec$lazy();
const test = /* #__PURE__ */ (() => test$0$test1$$rec.bar)();
export {test, test$0$test1$$rec, test$0$test2$$rec, test$0$test3$$rec};
49 changes: 17 additions & 32 deletions backend-es/test/snapshots-out/Snapshot.Tco03.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,24 @@
const test = /* #__PURE__ */ (() => {
const go = go$a0$copy => {
let go$a0 = go$a0$copy, go$c = true, go$r;
while (go$c) {
const n = go$a0;
const k = k$a0$copy => {
let k$a0 = k$a0$copy, k$c = true, k$r;
while (k$c) {
const m = k$a0;
if (m === 100) {
k$c = false;
go$a0 = m - 1 | 0;
continue;
}
if (m === 900) {
go$c = k$c = false;
go$r = 42;
continue;
}
k$a0 = m - 1 | 0;
}
return k$r;
};
if (n === 0) {
go$c = false;
go$r = n;
const test = n => {
const k = k$a0$copy => {
let k$a0 = k$a0$copy, k$c = true, k$r;
while (k$c) {
const m = k$a0;
if (m === 100) {
k$c = false;
k$r = test(m - 1 | 0);
continue;
}
if (n <= 100) {
go$a0 = n - 1 | 0;
if (m === 900) {
k$c = false;
k$r = 42;
continue;
}
k(n - 1 | 0);
k$a0 = m - 1 | 0;
}
return go$r;
return k$r;
};
return go;
})();
if (n === 0) { return n; }
if (n <= 100) { return test(n - 1 | 0); }
return k(n - 1 | 0);
};
export {test};
Loading