Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
1f127e2
Add `Term.Resolved` and `DefinitionSymbol`
FlandiaYingman Sep 20, 2025
113fbe6
Support lowering of `Term.Resolved`
FlandiaYingman Sep 27, 2025
cf8c1c7
Defer `.class` expansion until lower
FlandiaYingman Sep 27, 2025
0f16141
WIP: Test Cases
FlandiaYingman Oct 9, 2025
df23015
Use `Term.Resolved` for Sel resoultion
FlandiaYingman Oct 9, 2025
b1545c0
Merge branch 'hkmc2' into resolved-term
FlandiaYingman Oct 9, 2025
5501876
Merge branch 'hkmc2' into resolved-term
FlandiaYingman Oct 11, 2025
85efd07
Merge branch 'hkmc2' into resolved-term
FlandiaYingman Oct 11, 2025
8606815
Some refactor_ization_ WIP
FlandiaYingman Oct 14, 2025
019c3ae
wrapup 1
FlandiaYingman Oct 30, 2025
99bdb5f
Apply Mark's Patch
FlandiaYingman Oct 30, 2025
55ba010
Resolve symbols for inner SynthSel
FlandiaYingman Oct 31, 2025
cd3ac61
Fix Effect Handler
FlandiaYingman Oct 31, 2025
66a700b
Fix LLIR
FlandiaYingman Oct 31, 2025
b4235eb
Recover errors that were already there
FlandiaYingman Oct 31, 2025
18ff415
Fix WASM
FlandiaYingman Oct 31, 2025
da6fcd7
Merge branch 'hkmc2' into resolved-term
FlandiaYingman Oct 31, 2025
1e5db6b
Fix duplicate symbol error
FlandiaYingman Oct 31, 2025
a2fbf48
Enhance type resolution
FlandiaYingman Oct 31, 2025
b4c9cd1
Cleanup asDefnSym_TODO
FlandiaYingman Oct 31, 2025
37dc34a
Fix instanceof for objects
FlandiaYingman Oct 31, 2025
d1c43f1
Cleanup hasLiftedClass
FlandiaYingman Oct 31, 2025
ef12ca6
Fix lifter bugs
CAG2Mark Oct 31, 2025
5de57fe
Cleanup symbol_SelectSymbol
FlandiaYingman Oct 31, 2025
f58deae
Cleanup add docs
FlandiaYingman Oct 31, 2025
df75b33
Cleanup HandlerLowering
FlandiaYingman Oct 31, 2025
09c39ab
Merge remote-tracking branch 'mark/top-quality-fixes-2' into resolved…
FlandiaYingman Oct 31, 2025
46830c6
Cleanup lifter
FlandiaYingman Nov 1, 2025
04640c1
Cleanup Normalization
FlandiaYingman Nov 1, 2025
efc0587
Cleanup Pattern
FlandiaYingman Nov 1, 2025
0137185
Cleanup Term
FlandiaYingman Nov 1, 2025
9597814
Apply suggestion from @LPTK
FlandiaYingman Nov 1, 2025
0997535
Cleanup HkScratch
FlandiaYingman Nov 1, 2025
82c0879
Cleanup some tests 1
FlandiaYingman Nov 1, 2025
571d9dd
Cleanup some tests 2
FlandiaYingman Nov 1, 2025
79a7a88
Cleanup Resolver
FlandiaYingman Nov 1, 2025
6ff7a4f
Correct location of TermDefinition
FlandiaYingman Nov 1, 2025
383da7f
Cleanup Resolver
FlandiaYingman Nov 1, 2025
dd08cce
Cleanup Elaborator
FlandiaYingman Nov 1, 2025
ce4f4a6
Apply @LPTK's suggestion
FlandiaYingman Nov 8, 2025
7d92a23
Apply @LPTK's suggestion
FlandiaYingman Nov 8, 2025
146ee2b
Clarify test comment
FlandiaYingman Nov 8, 2025
63ec9ee
Refactor out `t.resolvedSym.flatMap(_.asBlkMember)`
FlandiaYingman Nov 8, 2025
c327e45
Deobfuscate Harry's top-quality code
FlandiaYingman Nov 8, 2025
ba1f714
Refactor out `t.resolvedSym.flatMap(_.asBlkMember)`
FlandiaYingman Nov 8, 2025
4fe9cf6
Preserve empty lines in Lifter
FlandiaYingman Nov 8, 2025
6c50dde
Refine symbol typing and clean redundancy
FlandiaYingman Nov 8, 2025
31fb16c
Apply @LPTK's suggestion
FlandiaYingman Nov 8, 2025
a8bb754
Apply @LPTK's suggestion
FlandiaYingman Nov 8, 2025
e026034
Fix @LPTK's suggestion
FlandiaYingman Nov 8, 2025
ae1a97b
Fix sanity check test cases
FlandiaYingman Nov 8, 2025
51a77b8
Remove unused definition
FlandiaYingman Nov 8, 2025
55ca3fd
Store `TermSymbol` directly in `BlockMemberSymbol` rather than `TermD…
FlandiaYingman Nov 8, 2025
d81d0e6
Fix "Worst part of the PR 👎“
FlandiaYingman Nov 8, 2025
f527f3d
Refine TODO comments in resolver
FlandiaYingman Nov 8, 2025
a37f2f5
Merge branch 'hkmc2' into resolved-term
FlandiaYingman Nov 11, 2025
7aa3feb
Merge branch 'hkmc2' into resolved-term
FlandiaYingman Nov 11, 2025
58de90d
Prelinminarily remove `defn` from BMS
FlandiaYingman Nov 11, 2025
2c45f41
Move `defn` definition to `DefinitionSymbol`
FlandiaYingman Nov 13, 2025
ebb3af6
Apply @LPTK's top-quality suggestion
FlandiaYingman Nov 13, 2025
4bd0874
Revert regression
FlandiaYingman Nov 13, 2025
859ff43
Remove something that I forgot to remove
FlandiaYingman Nov 13, 2025
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
4 changes: 2 additions & 2 deletions hkmc2/shared/src/main/scala/hkmc2/codegen/Lowering.scala
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ class Lowering()(using Config, TL, Raise, State, Ctx):
case sym: sem.BlockMemberSymbol =>
sym.trmImplTree.fold(sym.clsTree.isDefined)(_.k is syntax.Fun)
case sym: sem.TermSymbol => sym.k is syntax.Fun
// Do not perform safety check on `MatchResult` and `MatchFailure`.
case sym => (sym is State.matchResultClsSymbol) ||
// Do not perform safety check on `MatchSuccess` and `MatchFailure`.
case sym => (sym is State.matchSuccessClsSymbol) ||
(sym is State.matchFailureClsSymbol)
def conclude(fr: Path) = lowerCall(fr, isMlsFun, arg, t.toLoc)(k)

Expand Down
4 changes: 2 additions & 2 deletions hkmc2/shared/src/main/scala/hkmc2/semantics/Elaborator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ object Elaborator:
val nonLocalRet =
val id = new Ident("ret")
BlockMemberSymbol(id.name, Nil, true)
val (matchResultClsSymbol, matchResultTrmSymbol) =
val id = new Ident("MatchResult")
val (matchSuccessClsSymbol, matchSuccessTrmSymbol) =
val id = new Ident("MatchSuccess")
val td = TypeDef(syntax.Cls, App(id, Tup(Ident("output") :: Ident("bindings") :: Nil)), N)
val cs = ClassSymbol(td, id)
val ts = TermSymbol(syntax.Fun, N, id)
Expand Down
78 changes: 39 additions & 39 deletions hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,10 @@ class Resolver(tl: TraceLogger)
def simpleSplit(s: SimpleSplit): Unit = s match
case SimpleSplit.Cons(head: SimpleSplit.Head.Match, tail) =>
traverse(head.scrutinee, expect = NonModule(N))
head.pattern match
case FlatPattern.ClassLike(constructor = t) =>
head.pattern.subTerms.foreach:
case `t` => traverse(t, expect = PatternConstructor(N))
case other => traverse(other, expect = NonModule(N))
case _ =>
head.pattern.subTerms.foreach(traverse(_, expect = NonModule(N)))
split(head.continuation)
split(tail)
case Split.Let(sym, term, tail) =>
traversePattern(head.pattern)
simpleSplit(head.consequent)
simpleSplit(tail)
case SimpleSplit.Cons(SimpleSplit.Head.Let(sym, term), tail) =>
traverse(term, expect = NonModule(N))
simpleSplit(tail)
case SimpleSplit.Else(default) =>
Expand Down Expand Up @@ -419,35 +413,6 @@ class Resolver(tl: TraceLogger)

traverseBlock(cld.body.blk)(using withCtxParams)

def traversePattern(p: Pattern): Unit = p match
case _: (Pattern.Wildcard | Pattern.Literal | Pattern.Range) => ()
case Pattern.Constructor(target, patternArguments, arguments) =>
traverse(target, expect = PatternConstructor(N))
patternArguments.foreach(traversePattern(_))
arguments.foreach(_.foreach(traversePattern(_)))
case Pattern.Composition(_, left, right) =>
traversePattern(left)
traversePattern(right)
case Pattern.Negation(pattern) =>
traversePattern(pattern)
case Pattern.Concatenation(left, right) =>
traversePattern(left)
traversePattern(right)
case Pattern.Tuple(leading, spread, trailing) =>
leading.foreach(traversePattern(_))
spread.foreach(traversePattern(_))
trailing.foreach(traversePattern(_))
case Pattern.Record(fields) =>
fields.map((id, p) => traversePattern(p))
case Pattern.Chain(first, second) =>
traversePattern(first)
traversePattern(second)
case Pattern.Alias(pattern, _) =>
traversePattern(pattern)
case Pattern.Transform(pattern, transform) =>
traversePattern(pattern)
traverse(transform, expect = NonModule(N))

defn match

// Case: instance definition. Add the instance to the context.
Expand Down Expand Up @@ -487,6 +452,41 @@ class Resolver(tl: TraceLogger)
t.subTerms.foreach(traverse(_, expect = NonModule(N)))
ictx

def traversePattern(p: Pattern)(using ICtx): Unit = p match
case _: (Pattern.Wildcard | Pattern.Literal | Pattern.Range) => ()
case Pattern.Constructor(target, patternArguments) =>
traverse(target, expect = PatternConstructor(N))
patternArguments.foreach(_.foreach(traversePattern(_)))
case Pattern.Composition(_, left, right) =>
traversePattern(left)
traversePattern(right)
case Pattern.Negation(pattern) =>
traversePattern(pattern)
case Pattern.Concatenation(left, right) =>
traversePattern(left)
traversePattern(right)
case Pattern.Tuple(leading, spread) =>
leading.foreach(traversePattern(_))
spread.foreach: (_, spd, trailing) =>
traversePattern(spd)
trailing.foreach(traversePattern(_))
case Pattern.Record(fields) =>
fields.map((id, p) => traversePattern(p))
case Pattern.Chain(first, second) =>
traversePattern(first)
traversePattern(second)
case Pattern.Alias(pattern, _) =>
traversePattern(pattern)
case Pattern.Transform(pattern, _, transform) =>
traversePattern(pattern)
traverse(transform, expect = NonModule(N))
case Pattern.Annotated(pattern, annotations) =>
traversePattern(pattern)
annotations.map(_.toOption).flatten.foreach(traverse(_, expect = NonModule(N)))
case Pattern.Guarded(pattern, guard) =>
traversePattern(pattern)
traverse(guard, expect = NonModule(N))

/**
* Resolve a resolvable term. This involves:
* 1. Resolving the sub-terms of the term. Because resolving a term
Expand Down
92 changes: 10 additions & 82 deletions hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/Normalization.scala
Original file line number Diff line number Diff line change
Expand Up @@ -105,83 +105,11 @@ class Normalization(lowering: Lowering)(using tl: TL)(using Raise, Ctx, State) e
normalizeImpl(split)

def normalizeImpl(split: Split)(using vs: VarSet): Split = split match
case Split.Cons(Branch(scrutinee, pattern, consequent), alternative) => pattern match
case pattern: (FlatPattern.Lit | FlatPattern.Tuple | FlatPattern.Record) =>
log(s"MATCH: ${scrutinee.showDbg} is ${pattern.showDbg}")
// TODO(ucs): deduplicate [1]
val whenTrue = aliasOutputSymbols(scrutinee, pattern.output,
normalize(specialize(consequent ++ alternative, +, scrutinee, pattern)))
val whenFalse = normalizeImpl(specialize(alternative, -, scrutinee, pattern).clearFallback)
Branch(scrutinee, pattern, whenTrue) ~: whenFalse
case pattern @ FlatPattern.ClassLike(ctor, argsOpt, mode, _) =>
log(s"MATCH: ${scrutinee.showDbg} is ${pattern.showDbg}")
// Make sure that the pattern has correct arity and fields are accessible.
ctor.symbol.map(_.asClsLike) match
case N => // The constructor is not resolved. The error should have been reported.
normalizeImpl(alternative)
case S(N) =>
// The constructor is not a class-like symbol. But it might be a
// `VarSymbol` referencing to a pattern parameter.
ctor.symbol match
case S(symbol: VarSymbol) => symbol.decl match
case S(param @ Param(flags = FldFlags(pat = true))) =>
if argsOpt.fold(false)(_.nonEmpty) then
error(msg"Pattern parameters cannot be applied." -> ctor.toLoc)
mode match
case MatchMode.Default =>
normalizeExtractorPatternParameter(scrutinee, ctor, pattern.output, consequent, alternative)
case sp: MatchMode.StringPrefix =>
log(s"symbol name is ${symbol.nme}")
normalizeStringPrefixPattern(scrutinee, ctor, N, sp, pattern.output, consequent, alternative)
case MatchMode.Annotated(annotation) =>
error(msg"Annotated pattern parameters are not supported here." -> annotation.toLoc)
normalizeImpl(alternative)
case S(_) | N =>
error(msg"Cannot use this ${ctor.describe} as a pattern" -> ctor.toLoc)
normalizeImpl(alternative)
case S(_) | N =>
error(msg"Cannot use this ${ctor.describe} as a pattern" -> ctor.toLoc)
normalizeImpl(alternative)
case S(S(cls: (ClassSymbol | ModuleOrObjectSymbol))) if mode.isInstanceOf[MatchMode.StringPrefix] =>
// Match classes and modules are disallowed in the string mode.
normalizeImpl(alternative)
case S(S(cls: ClassSymbol)) =>
validateMatchMode(ctor, cls, mode)
if validateClassPattern(ctor, cls, ensureArguments(argsOpt)) then // TODO(ucs): deduplicate [1]
val whenTrue = aliasOutputSymbols(scrutinee, pattern.output,
normalize(specialize(consequent ++ alternative, +, scrutinee, pattern)))
val whenFalse = normalizeImpl(specialize(alternative, -, scrutinee, pattern).clearFallback)
Branch(scrutinee, pattern, whenTrue) ~: whenFalse
else // If any errors were raised, we skip the branch.
log("BROKEN"); normalizeImpl(alternative)
case S(S(mod: ModuleOrObjectSymbol)) =>
validateMatchMode(ctor, mod, mode)
if validateObjectPattern(pattern, mod, argsOpt) then // TODO(ucs): deduplicate [1]
val whenTrue = aliasOutputSymbols(scrutinee, pattern.output,
normalize(specialize(consequent ++ alternative, +, scrutinee, pattern)))
val whenFalse = normalizeImpl(specialize(alternative, -, scrutinee, pattern).clearFallback)
Branch(scrutinee, pattern, whenTrue) ~: whenFalse
else // If any errors were raised, we skip the branch.
log("BROKEN"); normalizeImpl(alternative)
case S(S(pat: PatternSymbol)) => mode match
// Note: `argsOpt` is supposed to be used in following cases, but
// the current implementation does not use it. The future version
// should properly handle the pattern arguments.
case MatchMode.Default =>
normalizeExtractorPattern(scrutinee, pat, ctor, argsOpt, pattern.output, consequent, normalizeImpl(alternative))
case sp: MatchMode.StringPrefix =>
normalizeStringPrefixPattern(scrutinee, ctor, argsOpt, sp, pattern.output, consequent, normalizeImpl(alternative))
case MatchMode.Annotated(annotation) => annotation.symbol match
case S(symbol) if symbol === ctx.builtins.annotations.compile =>
normalizeCompiledPattern(scrutinee, pat, ctor, argsOpt, pattern.output, consequent, normalizeImpl(alternative))
case S(_) =>
warn(msg"This annotation is not supported here." -> annotation.toLoc,
msg"Note: Patterns (like `${pat.nme}`) only support the `@compile` annotation." -> N)
normalizeExtractorPattern(scrutinee, pat, ctor, argsOpt, pattern.output,consequent, normalizeImpl(alternative))
case N =>
// Name resolution should have already reported an error. We
// treat this as an extractor pattern.
normalizeExtractorPattern(scrutinee, pat, ctor, argsOpt, pattern.output, consequent, normalizeImpl(alternative))
case Split.Cons(Branch(scrutinee, pattern, consequent), alternative) =>
log(s"MATCH: ${scrutinee.showDbg} is ${pattern.showDbg}")
val whenTrue = normalize(specialize(consequent ++ alternative.duplicate, +, scrutinee, pattern))
val whenFalse = normalizeImpl(specialize(alternative, -, scrutinee, pattern).clearFallback)
Branch(scrutinee, pattern, whenTrue) ~: whenFalse
case Split.Let(v, _, tail) if vs has v =>
log(s"LET: SKIP already declared scrutinee $v")
normalizeImpl(tail)
Expand Down Expand Up @@ -336,11 +264,11 @@ class Normalization(lowering: Lowering)(using tl: TL)(using Raise, Ctx, State) e
mkMatch(mkArgs(clsParams.iterator.zip(args).toList))
// Select the constructor's `.class` field.
lazy val ctorTerm = ctor.symbol match
case S(mem: BlockMemberSymbol) =>
// If the class is declaration-only, we do not need to
// select the class.
if !mem.hasLiftedClass || mem.defn.exists(_.hasDeclareModifier.isDefined) then ctor
else Term.SynthSel(ctor, Tree.Ident("class"))(mem.clsTree.orElse(mem.modOrObjTree).map(_.symbol), N).resolve
// case S(mem: BlockMemberSymbol) =>
// // If the class is declaration-only, we do not need to
// // select the class.
// if !mem.hasLiftedClass || mem.defn.exists(_.hasDeclareModifier.isDefined) then ctor
// else Term.SynthSel(ctor, Tree.Ident("class"))(mem.clsTree.orElse(mem.modOrObjTree).map(_.symbol), N).resolve
case _ => ctor
symbol match
case cls: ClassSymbol if ctx.builtins.virtualClasses contains cls =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,23 @@ trait TermSynthesizer(using State):

private lazy val runtimeRef: Term.Ref = State.runtimeSymbol.ref().resolve

/** Make a term that looks like `runtime.MatchResult` with its symbol. */
protected lazy val matchResultClass =
sel(runtimeRef, "MatchResult", State.matchResultClsSymbol).resolved(State.matchResultClsSymbol)
/** Make a term that looks like `runtime.MatchSuccess` with its symbol. */
protected lazy val matchSuccessClass =
sel(runtimeRef, "MatchSuccess", State.matchSuccessClsSymbol).resolved(State.matchSuccessClsSymbol)

/** Make a pattern that looks like `runtime.MatchResult.class`. */
protected def matchResultPattern(parameters: Opt[Ls[BlockLocalSymbol]]): FlatPattern.ClassLike =
FlatPattern.ClassLike(matchResultClass, parameters)
/** Make a pattern that looks like `runtime.MatchSuccess.class`. */
protected def matchSuccessPattern(parametersOpt: Opt[Ls[BlockLocalSymbol]]): FlatPattern.ClassLike =
val parameters = parametersOpt.map(_.map(_ -> N))
FlatPattern.ClassLike(matchSuccessClass, State.matchSuccessClsSymbol, parameters, false)(Tree.Dummy)

/** Make a term that looks like `runtime.MatchFailure` with its symbol. */
protected lazy val matchFailureClass =
sel(runtimeRef, "MatchFailure", State.matchFailureClsSymbol).resolved(State.matchFailureClsSymbol)

/** Make a pattern that looks like `runtime.MatchFailure.class`. */
protected def matchFailurePattern(parameters: Opt[Ls[BlockLocalSymbol]]): FlatPattern.ClassLike =
FlatPattern.ClassLike(matchFailureClass, parameters)
protected def matchFailurePattern(parametersOpt: Opt[Ls[BlockLocalSymbol]]): FlatPattern.ClassLike =
val parameters = parametersOpt.map(_.map(_ -> N))
FlatPattern.ClassLike(matchFailureClass, State.matchFailureClsSymbol, parameters, false)(Tree.Dummy)

protected lazy val tupleSlice = sel(sel(runtimeRef, "Tuple"), "slice")
protected lazy val tupleLazySlice = sel(sel(runtimeRef, "Tuple"), "lazySlice")
Expand Down Expand Up @@ -98,14 +100,14 @@ trait TermSynthesizer(using State):
val s = TempSymbol(N, dbgName)
Split.Let(s, cond, Branch(s.safeRef, inner) ~: Split.End)

protected final def makeMatchResult(output: Term) =
`new`(matchResultClass, tup(fld(output), fld(rcd())) :: Nil, "result of `MatchResult`")
protected final def makeMatchSuccess(output: Term) =
`new`(matchSuccessClass, tup(fld(output), fld(rcd())) :: Nil, "result of `MatchSuccess`")

protected final def makeMatchResult(output: Term, bindings: Term) =
`new`(matchResultClass, tup(fld(output), fld(bindings)) :: Nil, "result of `MatchResult`")
protected final def makeMatchSuccess(output: Term, bindings: Term) =
`new`(matchSuccessClass, tup(fld(output), fld(bindings)) :: Nil, "result of `MatchSuccess`")

protected final def makeMatchResult(output: Term, fields: Ls[RcdField | RcdSpread]) =
`new`(matchResultClass, tup(fld(output), fld(Term.Rcd(false, fields))) :: Nil, "result of `MatchResult`")
protected final def makeMatchSuccess(output: Term, fields: Ls[RcdField | RcdSpread]) =
`new`(matchSuccessClass, tup(fld(output), fld(Term.Rcd(false, fields))) :: Nil, "result of `MatchSuccess`")

protected final def makeMatchFailure(errors: Term = Term.Lit(UnitLit(true))) =
`new`(matchFailureClass, tup(fld(errors)) :: Nil, "result of `MatchFailure`")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class Instantiator(using tl: TL)(using Ctx, State, Raise):
val shouldCompile = annotations.foldLeft(true): (acc, termOrLoc) =>
val res = termOrLoc match
case R(term) => term.resolvedSym match
case S(symbol) if symbol is ctx.builtins.annotations.compile => N
case S(symbol) if symbol.asBlkMember.exists(_ is ctx.builtins.annotations.compile) => N
case S(_) | N => S(term.toLoc)
case L(loc) => S(loc)
res match
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ class SplitCompiler(using tl: TL)(using State, Ctx, Raise) extends TermSynthesiz
val shouldCompile = annotations.foldLeft(true): (acc, termOrLoc) =>
val res = termOrLoc match
case R(term) => term.resolvedSym match
case S(symbol) if symbol is ctx.builtins.annotations.compile => N
case S(symbol) if symbol.asBlkMember.exists(_ is ctx.builtins.annotations.compile) => N
case S(_) | N => S(term.toLoc)
case L(loc) => S(loc)
res match
Expand Down
4 changes: 2 additions & 2 deletions hkmc2/shared/src/test/mlscript/codegen/FieldSymbols.mls
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ case
//│ l = member:Foo
//│ disamb = S of class:Foo
//│ _2 = Assign:
//│ lhs = $param0
//│ lhs = $argument0$
//│ rhs = Select{sym=term:class:Foo.x}:
//│ qual = Ref:
//│ l = caseScrut
Expand All @@ -119,7 +119,7 @@ case
//│ rest = Assign: \
//│ lhs = a
//│ rhs = Ref:
//│ l = $param0
//│ l = $argument0$
//│ disamb = N
//│ rest = Return: \
//│ res = Ref:
Expand Down
6 changes: 2 additions & 4 deletions hkmc2/shared/src/test/mlscript/llir/nofib/scc.mls
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

:import NofibPrelude.mls
//│ Imported 104 member(s)
//│ Error: hkmc2.ErrorReport: Unsupported kind of Call Call(Select(Select(Ref($runtime,None),Ident(Tuple)),Ident(get)),List(Arg(None,Ref(t1,None)), Arg(None,Lit(IntLit(0)))))
//│ Stopped due to an error during the Llir generation
//│ /!!!\ Uncaught error: scala.NotImplementedError: Label not supported (of class String)


fun dfs(r, vsns, xs) = if vsns is [vs, ns] and
Expand All @@ -13,8 +12,7 @@ fun dfs(r, vsns, xs) = if vsns is [vs, ns] and
x :: xs and
inList(x, vs) then dfs(r, [vs, ns], xs)
dfs(r, [x :: vs, Nil], r(x)) is [vs', ns'] then dfs(r, [vs', (x :: ns') +: ns], xs)
//│ ═══[COMPILATION ERROR] Unsupported kind of Call Call(Select(Select(Ref($runtime,None),Ident(Tuple)),Ident(get)),List(Arg(None,Ref(vsns,None)), Arg(None,Lit(IntLit(0)))))
//│ Stopped due to an error during the Llir generation
//│ /!!!\ Uncaught error: scala.NotImplementedError: Label not supported (of class String)

fun stronglyConnComp(es, vs) =
fun swap(a) = if a is [f, s] then [s, f]
Expand Down
3 changes: 1 addition & 2 deletions hkmc2/shared/src/test/mlscript/nofib/scc.mls
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ fun dfs(r, vsns, xs) = if vsns is [vs, ns] and
x :: xs and
inList(x, vs) then dfs(r, [vs, ns], xs)
dfs(r, [x :: vs, Nil], r(x)) is [vs', ns'] then dfs(r, [vs', (x :: ns') +: ns], xs)
//│ ═══[COMPILATION ERROR] Unsupported kind of Call Call(Select(Select(Ref($runtime,None),Ident(Tuple)),Ident(get)),List(Arg(None,Ref(vsns,None)), Arg(None,Lit(IntLit(0)))))
//│ Stopped due to an error during the Llir generation
//│ /!!!\ Uncaught error: scala.NotImplementedError: Label not supported (of class String)

fun stronglyConnComp(es, vs) =
fun swap(a) = if a is [f, s] then [s, f]
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.