Skip to content

Commit a743ea4

Browse files
committed
Add do operator + misc improvements
1 parent 8d19148 commit a743ea4

File tree

14 files changed

+200
-53
lines changed

14 files changed

+200
-53
lines changed

hkmc2/shared/src/main/scala/hkmc2/bbml/bbML.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ class BBTyper(using elState: Elaborator.State, tl: TL):
347347
case Split.Else(alts) => sign match
348348
case S(sign) => ascribe(alts, sign)
349349
case _ => typeCheck(alts)
350-
case Split.Nil => ???
350+
case Split.End => ???
351351

352352
// * Note: currently, the returned type is not used or useful, but it could be in the future
353353
private def ascribe(lhs: Term, rhs: GeneralType)(using ctx: Ctx): (GeneralType, Type) =

hkmc2/shared/src/main/scala/hkmc2/codegen/Lowering.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class Lowering(using TL, Raise, Elaborator.State):
105105
TODO("Other argument list forms")
106106

107107
case st.Blk(Nil, res) => term(res)(k)
108+
case st.Blk(Lit(Tree.UnitLit(true)) :: stats, res) =>
109+
subTerm(st.Blk(stats, res))(k)
108110
case st.Blk((p @ (_: Ref | _: Lit)) :: stats, res) =>
109111
raise(WarningReport(msg"Pure expression in statement position" -> p.toLoc :: Nil))
110112
subTerm(st.Blk(stats, res))(k)
@@ -256,7 +258,7 @@ class Lowering(using TL, Raise, Elaborator.State):
256258
// if isWhile then Break(lbl, toBeginning = !topLevel)
257259
else End()
258260
)
259-
case Split.Nil =>
261+
case Split.End =>
260262
Throw(Instantiate(Value.Ref(Elaborator.Ctx.errorSymbol),
261263
Value.Lit(syntax.Tree.StrLit("match error")) :: Nil)) // TODO add failed-match scrutinee info
262264

hkmc2/shared/src/main/scala/hkmc2/semantics/Desugarer.scala

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
4444
extension (split: Split)
4545
/** Concatenate two splits. */
4646
def ++(fallback: Split): Split =
47-
if fallback == Split.Nil then
47+
if fallback == Split.End then
4848
split
4949
else if split.isFull then
5050
raise:
@@ -55,7 +55,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
5555
else (split match
5656
case Split.Cons(head, tail) => Split.Cons(head, tail ++ fallback)
5757
case Split.Let(name, term, tail) => Split.Let(name, term, tail ++ fallback)
58-
case Split.Else(_) /* impossible */ | Split.Nil => fallback)
58+
case Split.Else(_) /* impossible */ | Split.End => fallback)
5959

6060
import collection.mutable.HashMap
6161

@@ -177,15 +177,15 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
177177
// expand from the N-th to the second match.
178178
lazy val tailSplit =
179179
val innermostSplit = consequent match
180-
case L(tree) => termSplit(tree, identity)(Split.Nil)
180+
case L(tree) => termSplit(tree, identity)(Split.End)
181181
case R(tree) => (ctx: Ctx) => Split.default(term(tree)(using ctx))
182182
tail.foldRight(innermostSplit):
183183
case ((coda, pat), sequel) => ctx => trace(
184184
pre = s"conjunct matches <<< $tail",
185185
post = (res: Split) => s"conjunct matches >>> $res"
186186
):
187187
nominate(ctx, term(coda)(using ctx)):
188-
expandMatch(_, pat, sequel)(Split.Nil)
188+
expandMatch(_, pat, sequel)(Split.End)
189189
// We apply `finish` to the first coda and expand the first match.
190190
// Note that the scrutinee might be not an identifier.
191191
headCoda match
@@ -321,7 +321,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
321321
post = (res: Split) => s"patternSplit (else) >>> ${res.showDbg}"
322322
):
323323
elabFallback(backup)(ctx) match
324-
case Split.Nil => ()
324+
case Split.End => ()
325325
case _ => raise(ErrorReport(msg"Any following branches are unreachable." -> branch.toLoc :: Nil))
326326
Split.default(term(body)(using ctx))
327327
case branch => backup => ctx => trace(
@@ -338,12 +338,12 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
338338
// expand from the N-th to the second match.
339339
val tailSplit =
340340
val innermostSplit = consequent match
341-
case L(tree) => termSplit(tree, identity)(Split.Nil)
341+
case L(tree) => termSplit(tree, identity)(Split.End)
342342
case R(tree) => (ctx: Ctx) => Split.default(term(tree)(using ctx))
343343
tail.foldRight(innermostSplit):
344344
case ((coda, pat), sequel) => ctx =>
345345
nominate(ctx, term(coda)(using ctx)):
346-
expandMatch(_, pat, sequel)(Split.Nil)
346+
expandMatch(_, pat, sequel)(Split.End)
347347
.traced(
348348
pre = s"conjunct matches <<< $tail",
349349
post = (res: Split) => s"conjunct matches >>> $res")
@@ -376,7 +376,7 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
376376
// A single variable pattern or constructor pattern without parameters.
377377
case ctor: Ident => fallback => ctx => ctx.get(ctor.name) match
378378
case S(sym: ClassSymbol) => // TODO: refined
379-
Branch(ref, Pattern.Class(sym, N, false)(ctor), sequel(ctx)) :: fallback
379+
Branch(ref, Pattern.Class(sym, N, false)(ctor), sequel(ctx)) ~: fallback
380380
case S(_: VarSymbol) | N =>
381381
// If the identifier refers to a variable or nothing, we interpret it
382382
// as a variable pattern. If `fallback` is not used when `sequel`
@@ -405,8 +405,8 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
405405
Branch(
406406
ref,
407407
Pattern.Class(cls, S(params), false)(ctor), // TODO: refined?
408-
subMatches(params zip args, sequel)(Split.Nil)(ctx)
409-
) :: fallback
408+
subMatches(params zip args, sequel)(Split.End)(ctx)
409+
) ~: fallback
410410
case _ =>
411411
// Raise an error and discard `sequel`. Use `fallback` instead.
412412
raise(ErrorReport(msg"Unknown constructor `${ctor.name}`." -> ctor.toLoc :: Nil))
@@ -416,10 +416,10 @@ class Desugarer(tl: TraceLogger, elaborator: Elaborator)(using raise: Raise, sta
416416
pre = s"expandMatch: literal <<< $literal",
417417
post = (r: Split) => s"expandMatch: literal >>> ${r.showDbg}"
418418
):
419-
Branch(ref, Pattern.LitPat(literal), sequel(ctx)) :: fallback
419+
Branch(ref, Pattern.LitPat(literal), sequel(ctx)) ~: fallback
420420
// A single pattern in conjunction with more conditions
421421
case pattern and consequent => fallback => ctx =>
422-
val innerSplit = termSplit(consequent, identity)(Split.Nil)
422+
val innerSplit = termSplit(consequent, identity)(Split.End)
423423
expandMatch(scrutSymbol, pattern, innerSplit)(fallback)(ctx)
424424
case _ => fallback => _ =>
425425
// Raise an error and discard `sequel`. Use `fallback` instead.

hkmc2/shared/src/main/scala/hkmc2/semantics/Elaborator.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ object Elaborator:
3434
"process" -> TermSymbol(ImmutVal, N, Ident("process")),
3535
"fs" -> TermSymbol(ImmutVal, N, Ident("fs")),
3636
"String" -> TermSymbol(ImmutVal, N, Ident("String")),
37+
"Math" -> TermSymbol(ImmutVal, N, Ident("Math")),
3738
"Error" -> errorSymbol,
3839
))
3940
type Ctxl[A] = Ctx ?=> A
@@ -175,7 +176,7 @@ extends Importer:
175176
// case _ =>
176177
// raise(ErrorReport(msg"Illegal new expression." -> tree.toLoc :: Nil))
177178
case Tree.IfLike(kw, split) =>
178-
val desugared = new Desugarer(tl, this).termSplit(split, identity)(Split.Nil)(ctx)
179+
val desugared = new Desugarer(tl, this).termSplit(split, identity)(Split.End)(ctx)
179180
scoped("ucs:desugared"):
180181
log(s"Desugared:\n${Split.display(desugared)}")
181182
val normalized = new ucs.Normalization(tl)(desugared)
@@ -191,7 +192,7 @@ extends Importer:
191192
scrutVar.ref(),
192193
Pattern.Class(sym, N, true)(ctor),
193194
Split.default(term(cons))
194-
) :: Split.default(term(alts)))
195+
) ~: Split.default(term(alts)))
195196
Term.IfLike(Keyword.`if`, body)(body)
196197
case _ =>
197198
raise(ErrorReport(msg"Illegal pattern $cls." -> tree.toLoc :: Nil))
@@ -202,14 +203,14 @@ extends Importer:
202203
val body = Split.Let(scrutVar, scrutTerm, Branch(
203204
scrutVar.ref(),
204205
Split.default(term(cons))
205-
) :: Split.default(term(alts)))
206+
) ~: Split.default(term(alts)))
206207
Term.IfLike(Keyword.`if`, body)(body)
207208
case Tree.Quoted(body) => Term.Quoted(term(body))
208209
case Tree.Unquoted(body) => Term.Unquoted(term(body))
209210
case Tree.Case(branches) =>
210211
val scrut = VarSymbol(Ident("caseScrut"), nextUid)
211212
val desugarer = new Desugarer(tl, this)
212-
val des = desugarer.patternSplit(branches, scrut)(Split.Nil)(ctx)
213+
val des = desugarer.patternSplit(branches, scrut)(Split.End)(ctx)
213214
scoped("ucs:desugared"):
214215
log(s"Desugared:\n${Split.display(des)}")
215216
val nor = new ucs.Normalization(tl)(des)
@@ -218,6 +219,8 @@ extends Importer:
218219
Term.Lam(Param(FldFlags.empty, scrut, N) :: Nil, Term.IfLike(Keyword.`if`, des)(nor))
219220
case Modified(Keyword.`return`, kwLoc, body) =>
220221
Term.Ret(term(body))
222+
case Modified(Keyword.`do`, kwLoc, body) =>
223+
Term.Blk(term(body) :: Nil, unit)
221224
case Tree.Region(id: Tree.Ident, body) =>
222225
val sym = VarSymbol(id, nextUid)
223226
val nestCtx = ctx.copy(locals = ctx.locals ++ Ls(id.name -> sym))

hkmc2/shared/src/main/scala/hkmc2/semantics/Pattern.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ enum Pattern extends Located:
2626
case LitPat(literal) => literal.toLoc
2727
case pat @ Class(_, _, _) => pat.ident.toLoc
2828

29+
def subTerms: Ls[Term] = this match
30+
case Alias(nme, pattern) => pattern.subTerms
31+
case LitPat(literal) => Nil
32+
case Concrete(nme) => Nil
33+
case Var(nme) => Nil
34+
case Empty(source) => source :: Nil
35+
case Class(_, parameters, _) => Nil
36+
case Tuple(fields) => fields.flatMap(_.subTerms)
37+
case Record(entries) => entries.flatMap(_._2.subTerms)
2938

3039
/*
3140
def toLoc: Opt[Loc] = Loc(children)

hkmc2/shared/src/main/scala/hkmc2/semantics/Split.scala

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,45 @@ enum Split extends AutoLocated with ProductWithTail:
1616
case Cons(head: Branch, tail: Split)
1717
case Let(sym: BlockLocalSymbol, term: Term, tail: Split)
1818
case Else(default: Term)
19-
case Nil
19+
case End
2020

21-
inline def ::(head: Branch): Split = Split.Cons(head, this)
21+
inline def ~:(head: Branch): Split = Split.Cons(head, this)
2222

2323
lazy val isFull: Bool = this match
2424
case Split.Cons(_, tail) => tail.isFull
2525
case Split.Let(_, _, tail) => tail.isFull
2626
case Split.Else(_) => true
27-
case Split.Nil => false
27+
case Split.End => false
2828

2929
lazy val isEmpty: Bool = this match
3030
case Split.Let(_, _, tail) => tail.isEmpty
3131
case Split.Else(_) | Split.Cons(_, _) => false
32-
case Split.Nil => true
32+
case Split.End => true
3333

3434
final override def children: Ls[Located] = this match
3535
case Split.Cons(head, tail) => List(head, tail)
3636
case Split.Let(name, term, tail) => List(name, term, tail)
3737
case Split.Else(default) => List(default)
38-
case Split.Nil => List()
39-
38+
case Split.End => Nil
39+
40+
def subTerms: Ls[Term] = this match
41+
case Split.Cons(head, tail) => head.scrutinee :: head.pattern.subTerms ++ tail.subTerms
42+
case Split.Let(_, term, tail) => term :: tail.subTerms
43+
case Split.Else(term) => term :: Nil
44+
case Split.End => Nil
45+
4046
final def showDbg: String = this match
4147
case Split.Cons(head, tail) => s"${head.showDbg}; ${tail.showDbg}"
4248
case Split.Let(name, term, tail) => s"let ${name} = ${term.showDbg}; ${tail.showDbg}"
4349
case Split.Else(default) => s"else ${default.showDbg}"
44-
case Split.Nil => ""
50+
case Split.End => ""
4551

4652
final override def withLoc(loco: Option[Loc]): this.type =
4753
super.withLoc:
4854
this match
4955
// `Split.Nil` must not have a location. This prevents sharing locations,
5056
// which causes the assertion of distinctness of origins to fail.
51-
case Split.Nil => N
57+
case Split.End => N
5258
case _ => loco
5359

5460
var isFallback: Bool = false
@@ -61,8 +67,6 @@ object Split:
6167
/** Represents lines with indentations. */
6268
type Lines = Ls[(Int, Str)]
6369

64-
import scala.Nil as LNil
65-
6670
extension (lines: Lines)
6771
/** Increase the indentation of all lines by one. */
6872
def indent: Lines = lines.map:
@@ -91,13 +95,13 @@ object Split:
9195
def split(s: Split, isFirst: Bool, isTopLevel: Bool): Lines = s match
9296
case Split.Cons(head, tail) => (branch(head, isTopLevel) match
9397
case (n, line) :: tail => (n, (if isTopLevel then "" else "and ") + line) :: tail
94-
case LNil => LNil
98+
case Nil => Nil
9599
) ::: split(tail, false, isTopLevel)
96100
case Split.Let(nme, rhs, tail) =>
97101
(0, s"let $nme = ${rhs.showDbg}") :: split(tail, false, true)
98102
case Split.Else(term) =>
99-
(if isFirst then (0, s"then ${term.showDbg}") else (0, s"else ${term.showDbg}")) :: LNil
100-
case Split.Nil => LNil
103+
(if isFirst then (0, s"then ${term.showDbg}") else (0, s"else ${term.showDbg}")) :: Nil
104+
case Split.End => Nil
101105
def branch(b: Branch, isTopLevel: Bool): Lines =
102106
val Branch(scrutinee, pattern, continuation) = b
103107
val rest = split(continuation, true, isTopLevel)

hkmc2/shared/src/main/scala/hkmc2/semantics/Term.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ sealed trait Statement extends AutoLocated:
9696
case TyApp(pre, tarsg) => pre :: tarsg
9797
case Sel(pre, _) => pre :: Nil
9898
case Tup(fields) => fields.map(_.value)
99-
case IfLike(_, body) => Nil // TODO
99+
case IfLike(_, body) => body.subTerms
100100
case Lam(params, body) => body :: Nil
101101
case Blk(stats, res) => stats.flatMap(_.subTerms) ::: res :: Nil
102102
case Quoted(term) => term :: Nil

hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/Normalization.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
3939
else (these match
4040
case Split.Cons(head, tail) => Split.Cons(head, tail ++ those)
4141
case Split.Let(name, term, tail) => Split.Let(name, term, tail ++ those)
42-
case Split.Else(_) /* impossible */ | Split.Nil => those)
42+
case Split.Else(_) /* impossible */ | Split.End => those)
4343

4444
/** We don't care about `Pattern.Name` because they won't appear in `specialize`. */
4545
extension (lhs: Pattern)
@@ -93,7 +93,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
9393
log(s"MATCH: $scrutinee is $pattern")
9494
val whenTrue = normalize(specialize(consequent ++ alternative, +, scrutinee, pattern))
9595
val whenFalse = rec(specialize(alternative, -, scrutinee, pattern).clearFallback)
96-
Branch(scrutinee, pattern, whenTrue) :: whenFalse
96+
Branch(scrutinee, pattern, whenTrue) ~: whenFalse
9797
case _ =>
9898
raiseDesugaringError(msg"unsupported pattern matching: ${scrutinee.toString} is ${pattern.toString}" -> pattern.toLoc)
9999
Split.default(Term.Error)
@@ -106,7 +106,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
106106
case Split.Else(default) =>
107107
log(s"DFLT: ${default.showDbg}")
108108
Split.Else(default)
109-
case Split.Nil => Split.Nil
109+
case Split.End => Split.End
110110
rec(split)
111111

112112
/**
@@ -125,7 +125,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
125125
post = (r: Split) => s"S$mode >>> ${Split.display(r)}"
126126
):
127127
def rec(split: Split)(using mode: Mode, vs: VarSet): Split = split match
128-
case Split.Nil => log("CASE Nil"); split
128+
case Split.End => log("CASE Nil"); split
129129
case Split.Else(_) => log("CASE Else"); split
130130
case split @ Split.Let(sym, _, tail) =>
131131
log(s"CASE Let ${sym}")
@@ -136,7 +136,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
136136
case Branch(thatScrutineeVar, Pattern.Var(alias), continuation) =>
137137
Split.Let(alias, thatScrutineeVar, rec(continuation))
138138
case Branch(test, Pattern.LitPat(Tree.BoolLit(true)), continuation) =>
139-
head.copy(continuation = rec(continuation)) :: rec(tail)
139+
head.copy(continuation = rec(continuation)) ~: rec(tail)
140140
case Branch(thatScrutinee, thatPattern, continuation) =>
141141
if scrutinee === thatScrutinee then mode match
142142
case + =>
@@ -179,7 +179,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
179179
split.copy(tail = rec(tail))
180180
else
181181
log(s"Case 2: $scrutinee =/= $thatScrutinee")
182-
head.copy(continuation = rec(continuation)) :: rec(tail)
182+
head.copy(continuation = rec(continuation)) ~: rec(tail)
183183
end match
184184
end rec
185185
rec(split)(using mode, summon)

hkmc2/shared/src/main/scala/hkmc2/syntax/ParseRule.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ object ParseRule:
254254
case (body, _) => Open(body)}*),
255255
modified(`abstract`, Kw(`class`)(typeDeclBody(Cls))),
256256
modified(`mut`),
257+
modified(`do`),
257258
modified(`virtual`),
258259
modified(`override`),
259260
modified(`declare`),

hkmc2/shared/src/test/mlscript/bbml/bbGPCE.mls

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ fun assertNotZero(x) =
2222
`if (x `== `0.0) then `error else x
2323
let checkedDiv = x `=> y `=> x `/. (assertNotZero(y))
2424
run(checkedDiv)
25-
//│ ═══[ERROR] Cannot quote IfLike(keyword 'if',Let($scrut@71,Unquoted(Quoted(App(Ref(.==),Tup(List(Fld(‹›,Unquoted(Ref(x@69)),None), Fld(‹›,Unquoted(Quoted(Lit(DecLit(0.0)))),None)))))),Cons(Branch(Ref($scrut@71),LitPat(BoolLit(true)),Else(Unquoted(Quoted(Ref(.error))))),Else(Unquoted(Ref(x@69))))))
25+
//│ ╔══[ERROR] Cannot quote IfLike(keyword 'if',Let($scrut@71,Unquoted(Quoted(App(Ref(.==),Tup(List(Fld(‹›,Unquoted(Ref(x@69)),None), Fld(‹›,Unquoted(Quoted(Lit(DecLit(0.0)))),None)))))),Cons(Branch(Ref($scrut@71),LitPat(BoolLit(true)),Else(Unquoted(Quoted(Ref(.error))))),Else(Unquoted(Ref(x@69))))))
26+
//│ ║ l.22: `if (x `== `0.0) then `error else x
27+
//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2628
//│ Type: Num -> (Num -> Num)
2729

2830

hkmc2/shared/src/test/mlscript/bbml/bbQQ.mls

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ f `=> x `=> y `=> f`(x, y)
9292

9393
:fixme
9494
x `=> `if x `== `0.0 then `1.0 else x
95-
//│ ═══[ERROR] Cannot quote IfLike(keyword 'if',Let($scrut@84,Unquoted(Quoted(App(Ref(.==),Tup(List(Fld(‹›,Unquoted(Ref(x@82)),None), Fld(‹›,Unquoted(Quoted(Lit(DecLit(0.0)))),None)))))),Cons(Branch(Ref($scrut@84),LitPat(BoolLit(true)),Else(Unquoted(Quoted(Lit(DecLit(1.0)))))),Else(Unquoted(Ref(x@82))))))
95+
//│ ╔══[ERROR] Cannot quote IfLike(keyword 'if',Let($scrut@84,Unquoted(Quoted(App(Ref(.==),Tup(List(Fld(‹›,Unquoted(Ref(x@82)),None), Fld(‹›,Unquoted(Quoted(Lit(DecLit(0.0)))),None)))))),Cons(Branch(Ref($scrut@84),LitPat(BoolLit(true)),Else(Unquoted(Quoted(Lit(DecLit(1.0)))))),Else(Unquoted(Ref(x@82))))))
96+
//│ ║ l.94: x `=> `if x `== `0.0 then `1.0 else x
97+
//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^
9698
//│ Type: CodeBase[out ⊤ -> ⊥, ⊥, ?]
9799

98100
run(`1)
@@ -101,15 +103,15 @@ run(`1)
101103
:e
102104
run(1)
103105
//│ ╔══[ERROR] Type error in integer literal with expected type CodeBase[out α140_1, ⊥, ?]
104-
//│ ║ l.102: run(1)
106+
//│ ║ l.104: run(1)
105107
//│ ║ ^
106108
//│ ╙── because: cannot constrain Int <: CodeBase[out α140_1, ⊥, ?]
107109
//│ Type: ⊥
108110

109111
:e
110112
x `=> run(x)
111113
//│ ╔══[ERROR] Type error in reference with expected type CodeBase[out α143_3, ⊥, ?]
112-
//│ ║ l.110: x `=> run(x)
114+
//│ ║ l.112: x `=> run(x)
113115
//│ ║ ^
114116
//│ ╟── because: cannot constrain CodeBase[α141_3, <α>142_3, ⊥] <: CodeBase[out α143_3, ⊥, ?]
115117
//│ ╙── because: cannot constrain D( <α>142_3 ) <: ⊥
@@ -118,12 +120,12 @@ x `=> run(x)
118120
:e
119121
`let x = `42 `in run(x)
120122
//│ ╔══[ERROR] Type error in reference with expected type CodeBase[out α150_3, ⊥, ?]
121-
//│ ║ l.119: `let x = `42 `in run(x)
123+
//│ ║ l.121: `let x = `42 `in run(x)
122124
//│ ║ ^
123125
//│ ╟── because: cannot constrain CodeBase[α147_2, <α>149_3, ⊥] <: CodeBase[out α150_3, ⊥, ?]
124126
//│ ╙── because: cannot constrain D( <α>149_3 ) <: ⊥
125127
//│ ╔══[ERROR] Type error in unquoted term
126-
//│ ║ l.119: `let x = `42 `in run(x)
128+
//│ ║ l.121: `let x = `42 `in run(x)
127129
//│ ║ ^^^^^^
128130
//│ ╟── because: cannot constrain α150_3 <: CodeBase[out α151_3, out α152_3, ?]
129131
//│ ╟── because: cannot constrain α150_3 <: ¬(~{CodeBase[out α151_3, out α152_3, ?]})

0 commit comments

Comments
 (0)