Skip to content

Commit 57de229

Browse files
committed
Rename LitPat to Lit
1 parent a743ea4 commit 57de229

File tree

13 files changed

+30
-30
lines changed

13 files changed

+30
-30
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
@@ -287,7 +287,7 @@ class BBTyper(using elState: Elaborator.State, tl: TL):
287287
val res = freshVar(using ctx)
288288
constrain(bodyCtx, sk | res)
289289
(bodyTy, rhsCtx | res, rhsEff | bodyEff)
290-
case Term.IfLike(Keyword.`if`, Split.Cons(Branch(cond, Pattern.LitPat(BoolLit(true)), Split.Else(cons)), Split.Else(alts))) =>
290+
case Term.IfLike(Keyword.`if`, Split.Cons(Branch(cond, Pattern.Lit(BoolLit(true)), Split.Else(cons)), Split.Else(alts))) =>
291291
val (condTy, condCtx, condEff) = typeCode(cond)
292292
val (consTy, consCtx, consEff) = typeCode(cons)
293293
val (altsTy, altsCtx, altsEff) = typeCode(alts)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class Lowering(using TL, Raise, Elaborator.State):
231231
subTerm(scrut): sr =>
232232
tl.log(s"Binding scrut $scrut to $sr ${summon[Subst].map}")
233233
val cse = pat match
234-
case Pattern.LitPat(lit) => Case.Lit(lit) -> go(tail, topLevel = false)
234+
case Pattern.Lit(lit) => Case.Lit(lit) -> go(tail, topLevel = false)
235235
case Pattern.Class(cls, args0, _refined) =>
236236
val args = args0.getOrElse(Nil)
237237
val clsDefn = cls.defn.getOrElse(die)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ 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.Lit(literal), sequel(ctx)) ~: fallback
420420
// A single pattern in conjunction with more conditions
421421
case pattern and consequent => fallback => ctx =>
422422
val innerSplit = termSplit(consequent, identity)(Split.End)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import syntax.*
88
enum Pattern extends Located:
99

1010
case Alias(nme: VarSymbol, pattern: Pattern)
11-
case LitPat(literal: Literal)
11+
case Lit(literal: Literal)
1212
case Concrete(nme: VarSymbol)
1313
case Var(nme: BlockLocalSymbol)
1414
/**
@@ -23,12 +23,12 @@ enum Pattern extends Located:
2323
def boundSymbols: Ls[Str -> Symbol] = ???
2424

2525
def toLoc: Opt[Loc] = this match
26-
case LitPat(literal) => literal.toLoc
26+
case Lit(literal) => literal.toLoc
2727
case pat @ Class(_, _, _) => pat.ident.toLoc
2828

2929
def subTerms: Ls[Term] = this match
3030
case Alias(nme, pattern) => pattern.subTerms
31-
case LitPat(literal) => Nil
31+
case Lit(literal) => Nil
3232
case Concrete(nme) => Nil
3333
case Var(nme) => Nil
3434
case Empty(source) => source :: Nil
@@ -62,7 +62,7 @@ enum Pattern extends Located:
6262

6363
def showDbg: Str = this match
6464
case Alias(nme, pattern) => s"($nme as $pattern)"
65-
case LitPat(literal) => literal.idStr
65+
case Lit(literal) => literal.idStr
6666
case Concrete(nme) => s"`${nme.name}`"
6767
case Var(nme) => nme.toString
6868
case Empty(_) => ""

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final case class Branch(scrutinee: Term.Ref, pattern: Pattern, continuation: Spl
1010

1111
object Branch:
1212
def apply(scrutinee: Term.Ref, continuation: Split): Branch =
13-
Branch(scrutinee, Pattern.LitPat(Tree.BoolLit(true)), continuation)
13+
Branch(scrutinee, Pattern.Lit(Tree.BoolLit(true)), continuation)
1414

1515
enum Split extends AutoLocated with ProductWithTail:
1616
case Cons(head: Branch, tail: Split)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
4646
/** Checks if two patterns are the same. */
4747
def =:=(rhs: Pattern): Bool = (lhs, rhs) match
4848
case (Pattern.Class(s1, _, _), Pattern.Class(s2, _, _)) => s1 === s2
49-
case (Pattern.LitPat(l1), Pattern.LitPat(l2)) => l1 === l2
49+
case (Pattern.Lit(l1), Pattern.Lit(l2)) => l1 === l2
5050
case (_, _) => false
5151
/** Checks if `self` can be subsumed under `rhs`. */
5252
def <:<(rhs: Pattern): Bool =
5353
def mk(pattern: Pattern): Option[Literal | ClassSymbol] = lhs match
5454
case Pattern.Class(s, _, _) => S(s)
55-
case Pattern.LitPat(l) => S(l)
55+
case Pattern.Lit(l) => S(l)
5656
case _ => N
5757
compareCasePattern(mk(lhs), mk(rhs))
5858
/**
@@ -89,7 +89,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
8989
case Pattern.Var(vs) =>
9090
log(s"ALIAS: $scrutinee is $vs")
9191
Split.Let(vs, scrutinee, rec(consequent ++ alternative))
92-
case pattern @ (Pattern.LitPat(_) | Pattern.Class(_, _, _)) =>
92+
case pattern @ (Pattern.Lit(_) | Pattern.Class(_, _, _)) =>
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)
@@ -135,7 +135,7 @@ class Normalization(tl: TraceLogger)(using raise: Raise):
135135
head match
136136
case Branch(thatScrutineeVar, Pattern.Var(alias), continuation) =>
137137
Split.Let(alias, thatScrutineeVar, rec(continuation))
138-
case Branch(test, Pattern.LitPat(Tree.BoolLit(true)), continuation) =>
138+
case Branch(test, Pattern.Lit(Tree.BoolLit(true)), continuation) =>
139139
head.copy(continuation = rec(continuation)) ~: rec(tail)
140140
case Branch(thatScrutinee, thatPattern, continuation) =>
141141
if scrutinee === thatScrutinee then mode match

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,11 @@ class Pair[A, B](fst: A, snd: B)
208208

209209
:fixme
210210
if 1 < 2 then 1 else 0
211-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@131),LitPat(BoolLit(true)),Else(Lit(IntLit(1)))),Else(Lit(IntLit(0)))) (of class hkmc2.semantics.Split$Cons)
211+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@131),Lit(BoolLit(true)),Else(Lit(IntLit(1)))),Else(Lit(IntLit(0)))) (of class hkmc2.semantics.Split$Cons)
212212

213213
:fixme
214214
if false then 1 else "1"
215-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@133),LitPat(BoolLit(true)),Else(Lit(IntLit(1)))),Else(Lit(StrLit(1)))) (of class hkmc2.semantics.Split$Cons)
215+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@133),Lit(BoolLit(true)),Else(Lit(IntLit(1)))),Else(Lit(StrLit(1)))) (of class hkmc2.semantics.Split$Cons)
216216

217217

218218
if 1 is Int then 1 else 0
@@ -234,7 +234,7 @@ test("1")
234234
:fixme
235235
fun fact(n) =
236236
if n > 1 then n * fact(n - 1) else 1
237-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@147),LitPat(BoolLit(true)),Else(App(Ref(.*),Tup(List(Fld(‹›,Ref(n@145),None), Fld(‹›,App(Ref(globalThis:block#49.fact),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@145),None), Fld(‹›,Lit(IntLit(1)),None)))),None)))),None)))))),Else(Lit(IntLit(1)))) (of class hkmc2.semantics.Split$Cons)
237+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@147),Lit(BoolLit(true)),Else(App(Ref(.*),Tup(List(Fld(‹›,Ref(n@145),None), Fld(‹›,App(Ref(globalThis:block#49.fact),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@145),None), Fld(‹›,Lit(IntLit(1)),None)))),None)))),None)))))),Else(Lit(IntLit(1)))) (of class hkmc2.semantics.Split$Cons)
238238

239239
fact
240240
//│ Type: ⊥
@@ -247,7 +247,7 @@ fact(1)
247247
fun fact2 = case
248248
0 then 1
249249
n then n * fact2(n - 1)
250-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@156),LitPat(IntLit(0)),Else(Lit(IntLit(1)))),Let(n@157,Ref(caseScrut@156),Else(App(Ref(.*),Tup(List(Fld(‹›,Ref(n@157),None), Fld(‹›,App(Ref(globalThis:block#52.fact2),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@157),None), Fld(‹›,Lit(IntLit(1)),None)))),None)))),None))))))) (of class hkmc2.semantics.Split$Cons)
250+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@156),Lit(IntLit(0)),Else(Lit(IntLit(1)))),Let(n@157,Ref(caseScrut@156),Else(App(Ref(.*),Tup(List(Fld(‹›,Ref(n@157),None), Fld(‹›,App(Ref(globalThis:block#52.fact2),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@157),None), Fld(‹›,Lit(IntLit(1)),None)))),None)))),None))))))) (of class hkmc2.semantics.Split$Cons)
251251

252252
fact2
253253
//│ Type: ⊥

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ letreg of r =>
6060
123
6161
if next(it) > 0 then () => 0 else () => clear(b)
6262
k()
63-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@123),LitPat(BoolLit(true)),Else(Lam(List(),Lit(IntLit(0))))),Else(Lam(List(),App(Ref(globalThis:block#5.clear),Tup(List(Fld(‹›,Ref(b@112),None))))))) (of class hkmc2.semantics.Split$Cons)
63+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@123),Lit(BoolLit(true)),Else(Lam(List(),Lit(IntLit(0))))),Else(Lam(List(),App(Ref(globalThis:block#5.clear),Tup(List(Fld(‹›,Ref(b@112),None))))))) (of class hkmc2.semantics.Split$Cons)
6464

6565
:e
6666
letreg of r =>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ high(x => x + 1)
100100

101101
:fixme
102102
(if false then x => x else y => y): [A] -> A -> A
103-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@101),LitPat(BoolLit(true)),Else(Lam(List(Param(‹›,x@102,None)),Ref(x@102)))),Else(Lam(List(Param(‹›,y@100,None)),Ref(y@100)))) (of class hkmc2.semantics.Split$Cons)
103+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref($scrut@101),Lit(BoolLit(true)),Else(Lam(List(Param(‹›,x@102,None)),Ref(x@102)))),Else(Lam(List(Param(‹›,y@100,None)),Ref(y@100)))) (of class hkmc2.semantics.Split$Cons)
104104

105105

106106
fun baz: Int -> (([A] -> A -> A), Int) -> Int

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ fun power(x) = case
66
0 then `1.0
77
n then x `*. power(x)(n - 1)
88
power
9-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@42),LitPat(IntLit(0)),Else(Quoted(Lit(DecLit(1.0))))),Let(n@43,Ref(caseScrut@42),Else(Quoted(App(Ref(.*.),Tup(List(Fld(‹›,Unquoted(Ref(x@41)),None), Fld(‹›,Unquoted(App(App(Ref(globalThis:block#0.power),Tup(List(Fld(‹›,Ref(x@41),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@43),None), Fld(‹›,Lit(IntLit(1)),None)))),None))))),None)))))))) (of class hkmc2.semantics.Split$Cons)
9+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@42),Lit(IntLit(0)),Else(Quoted(Lit(DecLit(1.0))))),Let(n@43,Ref(caseScrut@42),Else(Quoted(App(Ref(.*.),Tup(List(Fld(‹›,Unquoted(Ref(x@41)),None), Fld(‹›,Unquoted(App(App(Ref(globalThis:block#0.power),Tup(List(Fld(‹›,Ref(x@41),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@43),None), Fld(‹›,Lit(IntLit(1)),None)))),None))))),None)))))))) (of class hkmc2.semantics.Split$Cons)
1010

1111

1212
fun id: [A] -> A -> A
@@ -22,7 +22,7 @@ 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),Lit(BoolLit(true)),Else(Unquoted(Quoted(Ref(.error))))),Else(Unquoted(Ref(x@69))))))
2626
//│ ║ l.22: `if (x `== `0.0) then `error else x
2727
//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2828
//│ Type: Num -> (Num -> Num)
@@ -51,7 +51,7 @@ fun body(x, y) = case
5151
fun gib_naive(n) =
5252
(x, y) `=> body(x, y)(n)
5353
let gn5 = run(gib_naive(5))
54-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@102),LitPat(IntLit(0)),Else(Ref(x@100))),Cons(Branch(Ref(caseScrut@102),LitPat(IntLit(1)),Else(Ref(y@101))),Let(n@103,Ref(caseScrut@102),Else(App(App(Ref(globalThis:block#7.body),Tup(List(Fld(‹›,Ref(y@101),None), Fld(‹›,Quoted(App(Ref(.+),Tup(List(Fld(‹›,Unquoted(Ref(x@100)),None), Fld(‹›,Unquoted(Ref(y@101)),None))))),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@103),None), Fld(‹›,Lit(IntLit(1)),None)))),None)))))))) (of class hkmc2.semantics.Split$Cons)
54+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@102),Lit(IntLit(0)),Else(Ref(x@100))),Cons(Branch(Ref(caseScrut@102),Lit(IntLit(1)),Else(Ref(y@101))),Let(n@103,Ref(caseScrut@102),Else(App(App(Ref(globalThis:block#7.body),Tup(List(Fld(‹›,Ref(y@101),None), Fld(‹›,Quoted(App(Ref(.+),Tup(List(Fld(‹›,Unquoted(Ref(x@100)),None), Fld(‹›,Unquoted(Ref(y@101)),None))))),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@103),None), Fld(‹›,Lit(IntLit(1)),None)))),None)))))))) (of class hkmc2.semantics.Split$Cons)
5555

5656
fun bind(rhs, k) = `let x = rhs `in k(x)
5757
bind
@@ -64,7 +64,7 @@ fun body(x, y) = case
6464
0 then x
6565
1 then y
6666
n then bind of x `+ y, (z => body(y, z)(n - 1)): [C] -> CodeBase[out Int, out C, out Any] -> CodeBase[out C, out Any]
67-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@130),LitPat(IntLit(0)),Else(Ref(x@128))),Cons(Branch(Ref(caseScrut@130),LitPat(IntLit(1)),Else(Ref(y@129))),Let(n@131,Ref(caseScrut@130),Else(App(Ref(globalThis:block#8.bind),Tup(List(Fld(‹›,Quoted(App(Ref(.+),Tup(List(Fld(‹›,Unquoted(Ref(x@128)),None), Fld(‹›,Unquoted(Ref(y@129)),None))))),None), Fld(‹›,Lam(List(Param(‹›,z@134,None)),App(App(Ref(globalThis:block#9.body),Tup(List(Fld(‹›,Ref(y@129),None), Fld(‹›,Ref(z@134),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@131),None), Fld(‹›,Lit(IntLit(1)),None)))),None))))),Some(Forall(List(QuantVar(C@138,None,None)),FunTy(Tup(List(Fld(‹›,TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(class:Int))), WildcardTy(None,Some(Ref(C@138))), WildcardTy(None,Some(Ref(class:Any))))),None))),TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(C@138))), WildcardTy(None,Some(Ref(class:Any))))),None))))))))))) (of class hkmc2.semantics.Split$Cons)
67+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@130),Lit(IntLit(0)),Else(Ref(x@128))),Cons(Branch(Ref(caseScrut@130),Lit(IntLit(1)),Else(Ref(y@129))),Let(n@131,Ref(caseScrut@130),Else(App(Ref(globalThis:block#8.bind),Tup(List(Fld(‹›,Quoted(App(Ref(.+),Tup(List(Fld(‹›,Unquoted(Ref(x@128)),None), Fld(‹›,Unquoted(Ref(y@129)),None))))),None), Fld(‹›,Lam(List(Param(‹›,z@134,None)),App(App(Ref(globalThis:block#9.body),Tup(List(Fld(‹›,Ref(y@129),None), Fld(‹›,Ref(z@134),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@131),None), Fld(‹›,Lit(IntLit(1)),None)))),None))))),Some(Forall(List(QuantVar(C@138,None,None)),FunTy(Tup(List(Fld(‹›,TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(class:Int))), WildcardTy(None,Some(Ref(C@138))), WildcardTy(None,Some(Ref(class:Any))))),None))),TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(C@138))), WildcardTy(None,Some(Ref(class:Any))))),None))))))))))) (of class hkmc2.semantics.Split$Cons)
6868

6969
fun bind: [G] -> (CodeBase[out Int, out G, out Any], [C] -> CodeBase[out Int, out C, out Any] -> CodeBase[out Int, out C | G, out Any]) -> CodeBase[out Int, out G, out Any]
7070
fun bind(rhs, k) = `let x = rhs `in k(x)
@@ -79,7 +79,7 @@ fun body(x, y) = case
7979
1 then y
8080
n then bind of x `+ y, (z => body(y, z)(n - 1)): [C] -> CodeBase[out Int, out C, out Any] -> CodeBase[out Int, out C, out Any]
8181
body
82-
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@157),LitPat(IntLit(0)),Else(Ref(x@155))),Cons(Branch(Ref(caseScrut@157),LitPat(IntLit(1)),Else(Ref(y@156))),Let(n@158,Ref(caseScrut@157),Else(App(Ref(globalThis:block#10.bind),Tup(List(Fld(‹›,Quoted(App(Ref(.+),Tup(List(Fld(‹›,Unquoted(Ref(x@155)),None), Fld(‹›,Unquoted(Ref(y@156)),None))))),None), Fld(‹›,Lam(List(Param(‹›,z@161,None)),App(App(Ref(globalThis:block#11.body),Tup(List(Fld(‹›,Ref(y@156),None), Fld(‹›,Ref(z@161),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@158),None), Fld(‹›,Lit(IntLit(1)),None)))),None))))),Some(Forall(List(QuantVar(C@165,None,None)),FunTy(Tup(List(Fld(‹›,TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(class:Int))), WildcardTy(None,Some(Ref(C@165))), WildcardTy(None,Some(Ref(class:Any))))),None))),TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(class:Int))), WildcardTy(None,Some(Ref(C@165))), WildcardTy(None,Some(Ref(class:Any))))),None))))))))))) (of class hkmc2.semantics.Split$Cons)
82+
//│ /!!!\ Uncaught error: scala.MatchError: Cons(Branch(Ref(caseScrut@157),Lit(IntLit(0)),Else(Ref(x@155))),Cons(Branch(Ref(caseScrut@157),Lit(IntLit(1)),Else(Ref(y@156))),Let(n@158,Ref(caseScrut@157),Else(App(Ref(globalThis:block#10.bind),Tup(List(Fld(‹›,Quoted(App(Ref(.+),Tup(List(Fld(‹›,Unquoted(Ref(x@155)),None), Fld(‹›,Unquoted(Ref(y@156)),None))))),None), Fld(‹›,Lam(List(Param(‹›,z@161,None)),App(App(Ref(globalThis:block#11.body),Tup(List(Fld(‹›,Ref(y@156),None), Fld(‹›,Ref(z@161),None)))),Tup(List(Fld(‹›,App(Ref(.-),Tup(List(Fld(‹›,Ref(n@158),None), Fld(‹›,Lit(IntLit(1)),None)))),None))))),Some(Forall(List(QuantVar(C@165,None,None)),FunTy(Tup(List(Fld(‹›,TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(class:Int))), WildcardTy(None,Some(Ref(C@165))), WildcardTy(None,Some(Ref(class:Any))))),None))),TyApp(Ref(class:CodeBase),List(WildcardTy(None,Some(Ref(class:Int))), WildcardTy(None,Some(Ref(C@165))), WildcardTy(None,Some(Ref(class:Any))))),None))))))))))) (of class hkmc2.semantics.Split$Cons)
8383

8484
fun gib(n) = (x, y) `=> body(x, y)(n)
8585
let g5 = run(gib(5))

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ f `=> x `=> y `=> f`(x, y)
8686
//│ ╔══[ERROR] Name not found: false
8787
//│ ║ l.79: `if `true then `true else `false
8888
//│ ╙── ^^^^^
89-
//│ ═══[ERROR] Cannot quote IfLike(keyword 'if',Let($scrut@80,Unquoted(Quoted(Error)),Cons(Branch(Ref($scrut@80),LitPat(BoolLit(true)),Else(Unquoted(Quoted(Error)))),Else(Unquoted(Quoted(Error))))))
89+
//│ ═══[ERROR] Cannot quote IfLike(keyword 'if',Let($scrut@80,Unquoted(Quoted(Error)),Cons(Branch(Ref($scrut@80),Lit(BoolLit(true)),Else(Unquoted(Quoted(Error)))),Else(Unquoted(Quoted(Error))))))
9090
//│ Type: CodeBase[⊥, ⊥, ?]
9191

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),Lit(BoolLit(true)),Else(Unquoted(Quoted(Lit(DecLit(1.0)))))),Else(Unquoted(Ref(x@82))))))
9696
//│ ║ l.94: x `=> `if x `== `0.0 then `1.0 else x
9797
//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^
9898
//│ Type: CodeBase[out ⊤ -> ⊥, ⊥, ?]

0 commit comments

Comments
 (0)