Skip to content

Commit 6eb0eb1

Browse files
committed
Desugar high order application into method calls
1 parent 9b052ed commit 6eb0eb1

File tree

13 files changed

+105
-133
lines changed

13 files changed

+105
-133
lines changed

compiler/shared/main/scala/mlscript/compiler/codegen/CppCodeGen.scala

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,22 @@ class CppCodeGen:
174174
case Node.LetExpr(name, expr, body) =>
175175
val stmts2 = stmts ++ Ls(Stmt.AutoBind(Ls(name |> mapName), codegen(expr)))
176176
codegen(body, storeInto)(using decls, stmts2)
177-
case Node.LetMethodCall(names, cls, method, args, body) =>
178-
val call = mlsMethodCall(cls, method.str |> mapName, args.map(toExpr))
179-
val stmts2 = stmts ++ Ls(Stmt.AutoBind(names.map(mapName), call))
180-
codegen(body, storeInto)(using decls, stmts2)
181-
case Node.LetApply(names, fn, args, body) if fn.str == "builtin" =>
177+
case Node.LetMethodCall(names, cls, method, IExpr.Ref(Name("builtin")) :: args, body) =>
182178
val stmts2 = stmts ++ codegenBuiltin(names, args.head.toString.replace("\"", ""), args.tail)
183179
codegen(body, storeInto)(using decls, stmts2)
184-
case Node.LetApply(names, fn, args, body) =>
185-
val call = mlsCall(fn.str |> mapName, args.map(toExpr))
180+
case Node.LetMethodCall(names, cls, method, args, body) =>
181+
val call = mlsMethodCall(cls, method.str |> mapName, args.map(toExpr))
186182
val stmts2 = stmts ++ Ls(Stmt.AutoBind(names.map(mapName), call))
187183
codegen(body, storeInto)(using decls, stmts2)
184+
// Use method calls instead of apply
185+
//
186+
// case Node.LetApply(names, fn, args, body) if fn.str == "builtin" =>
187+
// val stmts2 = stmts ++ codegenBuiltin(names, args.head.toString.replace("\"", ""), args.tail)
188+
// codegen(body, storeInto)(using decls, stmts2)
189+
// case Node.LetApply(names, fn, args, body) =>
190+
// val call = mlsCall(fn.str |> mapName, args.map(toExpr))
191+
// val stmts2 = stmts ++ Ls(Stmt.AutoBind(names.map(mapName), call))
192+
// codegen(body, storeInto)(using decls, stmts2)
188193
case Node.LetCall(names, defn, args, body) =>
189194
val call = Expr.Call(Expr.Var(defn.name |> mapName), args.map(toExpr))
190195
val stmts2 = stmts ++ Ls(Stmt.AutoBind(names.map(mapName), call))

compiler/shared/main/scala/mlscript/compiler/ir/Builder.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ final class Builder(fresh: Fresh, fnUid: FreshInt, classUid: FreshInt, tag: Fres
360360
case Result(Ref(f) :: Nil) => buildResultFromTerm(xs) {
361361
case Result(args) =>
362362
val v = fresh.make
363-
LetApply(List(v), f, args, v |> ref |> sresult |> k).attachTag(tag)
363+
// LetApply(List(v), f, args, v |> ref |> sresult |> k).attachTag(tag)
364+
LetMethodCall(List(v), ClassRef(R("Callable")), Name("apply" + args.length), (Ref(f): TrivialExpr) :: args, v |> ref |> sresult |> k).attachTag(tag)
364365
case node @ _ => node |> unexpectedNode
365366
}
366367
case node @ _ => node |> unexpectedNode

compiler/shared/main/scala/mlscript/compiler/ir/IR.scala

Lines changed: 10 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ enum Expr:
150150
def locMarker: LocMarker = this match
151151
case Ref(name) => LocMarker.MRef(name.str)
152152
case Literal(lit) => LocMarker.MLit(lit)
153-
case CtorApp(cls, args) => LocMarker.MCtorApp(cls.expectClass, args.map(_.toExpr.locMarker))
154-
case Select(name, cls, field) => LocMarker.MSelect(name.str, cls.expectClass, field)
153+
case CtorApp(cls, args) => LocMarker.MCtorApp(cls, args.map(_.toExpr.locMarker))
154+
case Select(name, cls, field) => LocMarker.MSelect(name.str, cls, field)
155155
case BasicOp(name, args) => LocMarker.MBasicOp(name, args.map(_.toExpr.locMarker))
156156

157157
enum Pat:
@@ -178,7 +178,9 @@ enum Node:
178178
// Intermediate forms:
179179
case LetExpr(name: Name, expr: Expr, body: Node)
180180
case LetMethodCall(names: Ls[Name], cls: ClassRef, method: Name, args: Ls[TrivialExpr], body: Node)
181-
case LetApply(names: Ls[Name], fn: Name, args: Ls[TrivialExpr], body: Node)
181+
// Deprecated:
182+
// LetApply(names, fn, args, body) => LetMethodCall(names, ClassRef(R("Callable")), Name("apply" + args.length), (Ref(fn): TrivialExpr) :: args, body)
183+
// case LetApply(names: Ls[Name], fn: Name, args: Ls[TrivialExpr], body: Node)
182184
case LetCall(names: Ls[Name], defn: DefnRef, args: Ls[TrivialExpr], body: Node)
183185

184186
var tag = DefnTag(-1)
@@ -203,7 +205,6 @@ enum Node:
203205
case Case(scrut, cases, default) => Case(f(scrut), cases.map { (cls, arm) => (cls, arm.mapName(f)) }, default.map(_.mapName(f)))
204206
case LetExpr(name, expr, body) => LetExpr(f(name), expr.mapName(f), body.mapName(f))
205207
case LetMethodCall(names, cls, method, args, body) => LetMethodCall(names.map(f), cls, f(method), args.map(_.mapNameOfTrivialExpr(f)), body.mapName(f))
206-
case LetApply(names, fn, args, body) => LetApply(names.map(f), f(fn), args.map(_.mapNameOfTrivialExpr(f)), body.mapName(f))
207208
case LetCall(names, defn, args, body) => LetCall(names.map(f), defn, args.map(_.mapNameOfTrivialExpr(f)), body.mapName(f))
208209

209210
def copy(ctx: Map[Str, Name]): Node = this match
@@ -216,10 +217,6 @@ enum Node:
216217
case LetMethodCall(names, cls, method, args, body) =>
217218
val names_copy = names.map(_.copy)
218219
LetMethodCall(names_copy, cls, method.copy, args.map(_.mapNameOfTrivialExpr(_.trySubst(ctx))), body.copy(ctx ++ names_copy.map(x => x.str -> x)))
219-
case LetApply(names, fn, args, body) =>
220-
val names_copy = names.map(_.copy)
221-
val fn_copy = fn.copy
222-
LetApply(names_copy, fn_copy, args.map(_.mapNameOfTrivialExpr(_.trySubst(ctx))), body.copy(ctx ++ names_copy.map(x => x.str -> x)))
223220
case LetCall(names, defn, args, body) =>
224221
val names_copy = names.map(_.copy)
225222
LetCall(names_copy, defn, args.map(_.mapNameOfTrivialExpr(_.trySubst(ctx))), body.copy(ctx ++ names_copy.map(x => x.str -> x)))
@@ -272,20 +269,6 @@ enum Node:
272269
<:> raw("in")
273270
<:> raw(s"-- $tag"),
274271
body.toDocument)
275-
case LetApply(xs, f, args, body) =>
276-
stack(
277-
raw("let**")
278-
<:> raw("(")
279-
<#> raw(xs.map(_.toString).mkString(","))
280-
<#> raw(")")
281-
<:> raw("=")
282-
<:> raw(f.toString)
283-
<#> raw("(")
284-
<#> raw(args.map{ x => x.toString }.mkString(","))
285-
<#> raw(")")
286-
<:> raw("in")
287-
<:> raw(s"-- $tag"),
288-
body.toDocument)
289272
case LetCall(xs, defn, args, body) =>
290273
stack(
291274
raw("let*")
@@ -307,8 +290,7 @@ enum Node:
307290
case Jump(defn, args) => LocMarker.MJump(defn.name, args.map(_.toExpr.locMarker))
308291
case Case(scrut, cases, default) => LocMarker.MCase(scrut.str, cases.map(_._1), default.isDefined)
309292
case LetExpr(name, expr, _) => LocMarker.MLetExpr(name.str, expr.locMarker)
310-
case LetMethodCall(names, cls, method, args, _) => LocMarker.MLetApply(names.map(_.str), method.str, args.map(_.toExpr.locMarker))
311-
case LetApply(names, fn, args, _) => LocMarker.MLetApply(names.map(_.str), fn.str, args.map(_.toExpr.locMarker))
293+
case LetMethodCall(names, cls, method, args, _) => LocMarker.MLetMethodCall(names.map(_.str), cls, method.str, args.map(_.toExpr.locMarker))
312294
case LetCall(names, defn, args, _) => LocMarker.MLetCall(names.map(_.str), defn.name, args.map(_.toExpr.locMarker))
313295
marker.tag = this.tag
314296
marker
@@ -331,7 +313,6 @@ object DefDfs:
331313
acc2.foldLeft(acc)((acc, x) => find(x)(using acc))
332314
case LetExpr(name, expr, body) => find(body)
333315
case LetMethodCall(names, cls, method, args, body) => find(body)
334-
case LetApply(names, fn, args, body) => find(body)
335316
case LetCall(names, defn, args, body) => find(body)(using defn.expectDefn :: acc)
336317

337318
def find(defn: Defn)(using acc: Ls[Defn]): Ls[Defn] = find(defn.body)
@@ -344,7 +325,6 @@ object DefDfs:
344325
acc2.foldLeft(acc)((acc, x) => findNames(x)(using acc))
345326
case LetExpr(name, expr, body) => findNames(body)
346327
case LetMethodCall(names, cls, method, args, body) => findNames(body)
347-
case LetApply(names, fn, args, body) => findNames(body)
348328
case LetCall(names, defn, args, body) => findNames(body)(using defn.name :: acc)
349329

350330
def findNames(defn: Defn)(using acc: Ls[Str]): Ls[Str] = findNames(defn.body)
@@ -493,15 +473,14 @@ case class DefnLocMarker(val defn: Str, val marker: LocMarker):
493473
enum LocMarker:
494474
case MRef(name: Str)
495475
case MLit(lit: Lit)
496-
case MCtorApp(name: ClassInfo, args: Ls[LocMarker])
497-
case MSelect(name: Str, cls: ClassInfo, field: Str)
476+
case MCtorApp(name: ClassRef, args: Ls[LocMarker])
477+
case MSelect(name: Str, cls: ClassRef, field: Str)
498478
case MBasicOp(name: Str, args: Ls[LocMarker])
499479
case MResult(res: Ls[LocMarker])
500480
case MJump(name: Str, args: Ls[LocMarker])
501481
case MCase(scrut: Str, cases: Ls[Pat], default: Bool)
502482
case MLetExpr(name: Str, expr: LocMarker)
503-
case MLetMethodCall(names: Ls[Str], cls: ClassInfo, method: Str, args: Ls[LocMarker])
504-
case MLetApply(names: Ls[Str], fn: Str, args: Ls[LocMarker])
483+
case MLetMethodCall(names: Ls[Str], cls: ClassRef, method: Str, args: Ls[LocMarker])
505484
case MLetCall(names: Ls[Str], defn: Str, args: Ls[LocMarker])
506485
var tag = DefnTag(-1)
507486

@@ -528,12 +507,6 @@ enum LocMarker:
528507
<:> raw(".")
529508
<:> raw(method)
530509
<:> raw("...")
531-
case MLetApply(x, f, args) =>
532-
raw("let")
533-
<:> raw(x.toString)
534-
<:> raw("=")
535-
<:> raw(f)
536-
<:> raw("(...)")
537510
case MLetCall(xs, defn, args) =>
538511
raw("let*")
539512
<:> raw("(")
@@ -547,7 +520,7 @@ enum LocMarker:
547520
case MLit(DecLit(lit)) => s"$lit" |> raw
548521
case MLit(StrLit(lit)) => s"$lit" |> raw
549522
case MLit(CharLit(lit)) => s"$lit" |> raw
550-
case MLit(UnitLit(lit)) => s"$lit" |> raw
523+
case MLit(UnitLit(undefinedOrNull)) => (if undefinedOrNull then "undefined" else "null") |> raw
551524
case _ => raw("...")
552525

553526
def show = s"$tag-" + toDocument.print

compiler/shared/main/scala/mlscript/compiler/ir/Interp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class Interpreter(verbose: Bool):
164164
ctx2 = ctx.copy(bindingCtx = ctx.bindingCtx ++ names.map{_.str}.zip(ys))
165165
res <- eval(body)(using ctx2)
166166
} yield res
167-
case LetApply(names, fn, args, body) => eval(LetMethodCall(names, ClassRef(R("Callable")), Name("apply" + args.length), (Ref(fn): TrivialExpr) :: args, body))
167+
// case LetApply(names, fn, args, body) => eval(LetMethodCall(names, ClassRef(R("Callable")), Name("apply" + args.length), (Ref(fn): TrivialExpr) :: args, body))
168168
case LetCall(names, defn, args, body) =>
169169
for {
170170
xs <- evalArgs(args)

compiler/shared/main/scala/mlscript/compiler/ir/RefResolver.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ private final class RefResolver(defs: Map[Str, Defn], classes: Map[Str, ClassInf
2929
case Case(scrut, cases, default) => cases foreach { (_, body) => f(body) }; default foreach f
3030
case LetExpr(name, expr, body) => f(expr); f(body)
3131
case LetMethodCall(names, cls, method, args, body) => f(body)
32-
case LetApply(name, fn, args, body) => f(body)
3332
case LetCall(resultNames, defnref, args, body) =>
3433
defs.get(defnref.name) match
3534
case Some(defn) => defnref.defn = Left(defn)

compiler/shared/main/scala/mlscript/compiler/ir/Validator.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ private final class DefnRefInSet(defs: Set[Defn], classes: Set[ClassInfo]):
2424
case Case(scrut, cases, default) => cases foreach { (_, body) => f(body) }; default foreach f
2525
case LetExpr(name, expr, body) => f(body)
2626
case LetMethodCall(names, cls, method, args, body) => f(body)
27-
case LetApply(name, fn, args, body) => f(body)
2827
case LetCall(res, defnref, args, body) =>
2928
defnref.getDefn match {
3029
case Some(real_defn) => if (!defs.exists(_ eq real_defn)) throw IRError("ref is not in the set")

compiler/shared/main/scala/mlscript/compiler/optimizer/Analysis.scala

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class UsefulnessAnalysis(verbose: Bool = false):
4646
case Jump(defn, args) => args.foreach(f)
4747
case Case(scrut, cases, default) => addUse(scrut); cases.foreach { case (cls, body) => f(body) }; default.foreach(f)
4848
case LetMethodCall(names, cls, method, args, body) => addUse(method); args.foreach(f); names.foreach(addDef); f(body)
49-
case LetApply(names, fn, args, body) => addUse(fn); args.foreach(f); names.foreach(addDef); f(body)
5049
case LetExpr(name, expr, body) => f(expr); addDef(name); f(body)
5150
case LetCall(names, defn, args, body) => args.foreach(f); names.foreach(addDef); f(body)
5251

@@ -89,10 +88,6 @@ class FreeVarAnalysis(extended_scope: Bool = true, verbose: Bool = false):
8988
var fv2 = args.foldLeft(fv)((acc, arg) => f(using defined)(arg.toExpr, acc))
9089
val defined2 = resultNames.foldLeft(defined)((acc, name) => acc + name.str)
9190
f(using defined2)(body, fv2)
92-
case LetApply(resultNames, fn, args, body) =>
93-
var fv2 = args.foldLeft(fv)((acc, arg) => f(using defined)(arg.toExpr, acc))
94-
val defined2 = resultNames.foldLeft(defined)((acc, name) => acc + name.str)
95-
f(using defined2)(body, fv2)
9691
case LetExpr(name, expr, body) =>
9792
val fv2 = f(using defined)(expr, fv)
9893
val defined2 = defined + name.str

compiler/shared/test/diff-ir/Class.mls

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ main()
9797
//│ R: [None],
9898
//│ Rec: None,
9999
//│ 1,
100-
//│ let** (x$12) = builtin(println,x$11) in -- #70
100+
//│ let x$12 = Callable.apply2(builtin,println,x$11) in -- #70
101101
//│ x$12 -- #69
102102
//│ )),
103103
//│ ClassInfo(10, Fn2, [a], parents: Callable, methods:
@@ -106,8 +106,8 @@ main()
106106
//│ R: [None],
107107
//│ Rec: None,
108108
//│ 1,
109-
//│ let** (x$14) = builtin(println,a) in -- #86
110-
//│ let** (x$15) = builtin(println,x$13) in -- #85
109+
//│ let x$14 = Callable.apply2(builtin,println,a) in -- #86
110+
//│ let x$15 = Callable.apply2(builtin,println,x$13) in -- #85
111111
//│ x$15 -- #84
112112
//│ )),
113113
//│ ClassInfo(11, Demo, [n], parents: , methods:
@@ -123,7 +123,7 @@ main()
123123
//│ R: [None],
124124
//│ Rec: None,
125125
//│ 1,
126-
//│ let** (x$1) = fn$0(1) in -- #8
126+
//│ let x$1 = Callable.apply1(fn$0,1) in -- #8
127127
//│ x$1 -- #7
128128
//│ )
129129
//│ Def(1, main, [], [],
@@ -138,7 +138,7 @@ main()
138138
//│ let* (x$6) = f(x$4) in -- #52
139139
//│ let x$7 = Fn2(4) in -- #51
140140
//│ let x$8 = Fn2.apply1(x$7,5) in -- #50
141-
//│ let** (x$9) = x$7(6) in -- #49
141+
//│ let x$9 = Callable.apply1(x$7,6) in -- #49
142142
//│ let* (x$10) = f(x$7) in -- #48
143143
//│ x$10 -- #47
144144
//│ )
@@ -212,7 +212,7 @@ main()
212212
//│ R: [None],
213213
//│ Rec: None,
214214
//│ 1,
215-
//│ let** (x$12) = builtin(println,x$11) in -- #70
215+
//│ let x$12 = Callable.apply2(builtin,println,x$11) in -- #70
216216
//│ x$12 -- #69
217217
//│ )),
218218
//│ ClassInfo(10, Fn2, [a], parents: Callable, methods:
@@ -221,8 +221,8 @@ main()
221221
//│ R: [None],
222222
//│ Rec: None,
223223
//│ 1,
224-
//│ let** (x$14) = builtin(println,a) in -- #86
225-
//│ let** (x$15) = builtin(println,x$13) in -- #85
224+
//│ let x$14 = Callable.apply2(builtin,println,a) in -- #86
225+
//│ let x$15 = Callable.apply2(builtin,println,x$13) in -- #85
226226
//│ x$15 -- #84
227227
//│ )),
228228
//│ ClassInfo(11, Demo, [n], parents: , methods:
@@ -238,7 +238,7 @@ main()
238238
//│ R: [None],
239239
//│ Rec: None,
240240
//│ 1,
241-
//│ let** (x$1) = fn$0(1) in -- #8
241+
//│ let x$1 = Callable.apply1(fn$0,1) in -- #8
242242
//│ x$1 -- #7
243243
//│ )
244244
//│ Def(1, main, [], [],
@@ -253,7 +253,7 @@ main()
253253
//│ let* (x$6) = f(x$4) in -- #52
254254
//│ let x$7 = Fn2(4) in -- #51
255255
//│ let x$8 = Fn2.apply1(x$7,5) in -- #50
256-
//│ let** (x$9) = x$7(6) in -- #49
256+
//│ let x$9 = Callable.apply1(x$7,6) in -- #49
257257
//│ let* (x$10) = f(x$7) in -- #48
258258
//│ x$10 -- #47
259259
//│ )

compiler/shared/test/diff-ir/Currying.mls

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ main()
135135
//│ Rec: None,
136136
//│ 1,
137137
//│ let* (x$6) = add2c(1) in -- #42
138-
//│ let** (x$7) = x$6(2) in -- #41
138+
//│ let x$7 = Callable.apply1(x$6,2) in -- #41
139139
//│ let* (x$8) = add2(1,2) in -- #40
140140
//│ let* (x$9) = add3c(1) in -- #39
141-
//│ let** (x$10) = x$9(2) in -- #38
142-
//│ let** (x$11) = x$10(3) in -- #37
141+
//│ let x$10 = Callable.apply1(x$9,2) in -- #38
142+
//│ let x$11 = Callable.apply1(x$10,3) in -- #37
143143
//│ x$11 -- #36
144144
//│ )
145145
//│ },
@@ -264,11 +264,11 @@ main()
264264
//│ Rec: None,
265265
//│ 1,
266266
//│ let* (x$6) = add2c(1) in -- #42
267-
//│ let** (x$7) = x$6(2) in -- #41
267+
//│ let x$7 = Callable.apply1(x$6,2) in -- #41
268268
//│ let* (x$8) = add2(1,2) in -- #40
269269
//│ let* (x$9) = add3c(1) in -- #39
270-
//│ let** (x$10) = x$9(2) in -- #38
271-
//│ let** (x$11) = x$10(3) in -- #37
270+
//│ let x$10 = Callable.apply1(x$9,2) in -- #38
271+
//│ let x$11 = Callable.apply1(x$10,3) in -- #37
272272
//│ x$11 -- #36
273273
//│ )
274274
//│ },

compiler/shared/test/diff-ir/LiftClass.mls

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ main(4)
9292
//│ Rec: None,
9393
//│ 1,
9494
//│ let x$2 = InnerClass(1,x$1) in -- #26
95-
//│ let** (x$3) = x$2(2) in -- #25
96-
//│ let** (x$4) = x$2(3) in -- #24
95+
//│ let x$3 = Callable.apply1(x$2,2) in -- #25
96+
//│ let x$4 = Callable.apply1(x$2,3) in -- #24
9797
//│ let x$5 = +(x$3,x$4) in -- #23
9898
//│ x$5 -- #22
9999
//│ )
@@ -177,8 +177,8 @@ main(4)
177177
//│ Rec: None,
178178
//│ 1,
179179
//│ let x$2 = InnerClass(1,x$1) in -- #26
180-
//│ let** (x$3) = x$2(2) in -- #25
181-
//│ let** (x$4) = x$2(3) in -- #24
180+
//│ let x$3 = Callable.apply1(x$2,2) in -- #25
181+
//│ let x$4 = Callable.apply1(x$2,3) in -- #24
182182
//│ let x$5 = +(x$3,x$4) in -- #23
183183
//│ x$5 -- #22
184184
//│ )
@@ -296,10 +296,10 @@ main(4)
296296
//│ Rec: None,
297297
//│ 1,
298298
//│ let x$2 = InnerClass(1) in -- #36
299-
//│ let** (x$3) = x$2(2) in -- #35
300-
//│ let** (x$4) = x$3(2) in -- #34
301-
//│ let** (x$5) = x$2(3) in -- #33
302-
//│ let** (x$6) = x$5(1) in -- #32
299+
//│ let x$3 = Callable.apply1(x$2,2) in -- #35
300+
//│ let x$4 = Callable.apply1(x$3,2) in -- #34
301+
//│ let x$5 = Callable.apply1(x$2,3) in -- #33
302+
//│ let x$6 = Callable.apply1(x$5,1) in -- #32
303303
//│ let x$7 = +(x$4,x$6) in -- #31
304304
//│ x$7 -- #30
305305
//│ )
@@ -391,10 +391,10 @@ main(4)
391391
//│ Rec: None,
392392
//│ 1,
393393
//│ let x$2 = InnerClass(1) in -- #36
394-
//│ let** (x$3) = x$2(2) in -- #35
395-
//│ let** (x$4) = x$3(2) in -- #34
396-
//│ let** (x$5) = x$2(3) in -- #33
397-
//│ let** (x$6) = x$5(1) in -- #32
394+
//│ let x$3 = Callable.apply1(x$2,2) in -- #35
395+
//│ let x$4 = Callable.apply1(x$3,2) in -- #34
396+
//│ let x$5 = Callable.apply1(x$2,3) in -- #33
397+
//│ let x$6 = Callable.apply1(x$5,1) in -- #32
398398
//│ let x$7 = +(x$4,x$6) in -- #31
399399
//│ x$7 -- #30
400400
//│ )

compiler/shared/test/diff-ir/LiftFun.mls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ main(1, 42)
548548
//│ Rec: None,
549549
//│ 1,
550550
//│ let x$3 = Lambda$0(key$0) in -- #14
551-
//│ let** (x$4) = x$3(init$0) in -- #13
551+
//│ let x$4 = Callable.apply1(x$3,init$0) in -- #13
552552
//│ x$4 -- #12
553553
//│ )
554554
//│ Def(7, ping, [x$5,key$1], [{},{}],
@@ -674,7 +674,7 @@ main(1, 42)
674674
//│ Rec: None,
675675
//│ 1,
676676
//│ let x$3 = Lambda$0(key$0) in -- #14
677-
//│ let** (x$4) = x$3(init$0) in -- #13
677+
//│ let x$4 = Callable.apply1(x$3,init$0) in -- #13
678678
//│ x$4 -- #12
679679
//│ )
680680
//│ Def(7, ping, [x$5,key$1], [{},{}],

0 commit comments

Comments
 (0)