Skip to content

Conversation

chengluyu
Copy link
Member

No description provided.

# Conflicts:
#	hkmc2/shared/src/main/scala/hkmc2/codegen/Block.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/Lowering.scala
#	hkmc2/shared/src/main/scala/hkmc2/codegen/js/JSBuilder.scala
#	hkmc2/shared/src/main/scala/hkmc2/semantics/Elaborator.scala
#	hkmc2/shared/src/main/scala/hkmc2/semantics/Resolver.scala
#	hkmc2/shared/src/main/scala/hkmc2/semantics/Term.scala
#	hkmc2/shared/src/main/scala/hkmc2/semantics/ups/NaiveCompiler.scala
#	hkmc2/shared/src/test/mlscript-compile/Runtime.mjs
#	hkmc2/shared/src/test/mlscript/backlog/ToTriage.mls
#	hkmc2/shared/src/test/mlscript/codegen/ClassMatching.mls
#	hkmc2/shared/src/test/mlscript/codegen/MergeMatchArms.mls
#	hkmc2/shared/src/test/mlscript/handlers/NonLocalReturns.mls
#	hkmc2/shared/src/test/mlscript/handlers/RecursiveHandlers.mls
#	hkmc2/shared/src/test/mlscript/ucs/general/LogicalConnectives.mls
#	hkmc2/shared/src/test/mlscript/ups/examples/Record.mls
//│ }
//│ } else if (x3 instanceof None1.class) { return "ok" } else { return Predef.print("oops") }
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the new approach turns some things that were tail calls into non-tail calls.

I wonder if we could preserve them in general (without duplicating the default branches). Seems difficult.

We probably want to add this to the UCS tracking issue (with a link to this message).

//│ tmp9 = "ok";
//│ } else { tmp9 = "oops"; }
//│ tmp9 = "oops";
//│ break split_root$;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to avoid generating this break when it doesn't do anything?

//│ }
//│ } else { break split_1$3 }
//│ }
//│ tmp4 = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed, it would be good to avoid the labels and breaks when the default branch is small (esp. when it's a simple value).



// * FIXME should warn, be rejected, or compare both values for equality
:e
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:e
// * TODO: we might want to accept this and compare the two values for equality
:e

@@ -1431,9 +1431,19 @@ extends Importer with ucs.SplitElaborator:
* variables we found in `p`. */
def arrow(lhs: Tree, rhs: Tree): Ctxl[Pattern] =
val pattern = go(lhs)
val termCtx = ctx ++ pattern.variables.allocate
val variables = pattern.variables.allocate
// - `contextEntries` will be added to the context
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: document why symbols are duplicated here; add to future minor improvements in tracking issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants