-
Notifications
You must be signed in to change notification settings - Fork 35
Unify patterns in UCS and UPS #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: hkmc2
Are you sure you want to change the base?
Conversation
# 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
//│ break split_root$ | ||
//│ } else { break split_1$ } | ||
//│ } | ||
//│ } else if (x3 instanceof None1.class) { return "ok" } else { return Predef.print("oops") } |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These non-tail calls are added to prevent the control flow from falling through into the outer branches. I think there is a way to preserve the tail calls. I gave it another shot today but the logic is convoluted and I don’t have time to work on it. I’ll add it to the backlog issue.
//│ } | ||
//│ } else { break split_1$3 } | ||
//│ } | ||
//│ tmp4 = false; |
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. I’ll add it into the backlog.
hkmc2/shared/src/test/mlscript/ups/specialization/SimpleLiterals.mls
Outdated
Show resolved
Hide resolved
# Conflicts: # hkmc2/shared/src/main/scala/hkmc2/codegen/Block.scala # hkmc2/shared/src/main/scala/hkmc2/semantics/Term.scala # hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/Desugarer.scala # hkmc2/shared/src/main/scala/hkmc2/syntax/Tree.scala # hkmc2/shared/src/test/mlscript/backlog/UCS.mls # hkmc2/shared/src/test/mlscript/codegen/Do.mls # hkmc2/shared/src/test/mlscript/codegen/FieldSymbols.mls # hkmc2/shared/src/test/mlscript/syntax/WeirdBrackets.mls # hkmc2/shared/src/test/mlscript/ucs/hygiene/HygienicBindings.mls # hkmc2/shared/src/test/mlscript/ucs/hygiene/PatVars.mls # hkmc2/shared/src/test/mlscript/ucs/patterns/AliasPattern.mls # hkmc2/shared/src/test/mlscript/ucs/syntax/NestedOpSplits.mls # hkmc2/shared/src/test/mlscript/ups/Future.mls # hkmc2/shared/src/test/mlscript/ups/examples/Record.mls # hkmc2/shared/src/test/mlscript/ups/parametric/EtaConversion.mls
It’s been a while. I need some time for self review and to record the issues that should be added to the backlog. Then I will ping you and let you know which parts need your review. @LPTK |
No description provided.