Support "match only" mode in pattern compilation#421
Support "match only" mode in pattern compilation#421chengluyu wants to merge 20 commits intohkust-taco:hkmc2from
Conversation
# Conflicts: # hkmc2/shared/src/test/mlscript/ups/specialization/SimpleLiterals.mls
hkmc2/shared/src/main/scala/hkmc2/semantics/ups/SplitCompiler.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: Lionel Parreaux <lionel.parreaux@gmail.com>
| // When the instantiated pattern is transform-free and thus preserves the | ||
| // original scrutinee as its output, `MatchOnly` is used and the caller can | ||
| // obtain the scrutinee directly. | ||
| val canReuseScrutineeOutput = preservesScrutineeOutput(synonym, context) |
There was a problem hiding this comment.
Shouldn't this be
| val canReuseScrutineeOutput = preservesScrutineeOutput(synonym, context) | |
| val canReuseScrutineeAsOutput = preservesScrutineeAsOutput(synonym, context) |
?
| // Comments: I think the output from the compiled pattern is semantically | ||
| // correct, but people might expect the output from the translated pattern. | ||
| // The problem is that we can't synthesize a record with the class tags. |
| //│ }; | ||
| //│ end | ||
|
|
||
| :sir |
There was a problem hiding this comment.
I think this is too much output to commit.
There was a problem hiding this comment.
Please clean up this file: only keep one or two small, representative uses of :sir.
There was a problem hiding this comment.
Please clean up this file: only keep one or two small, representative uses of :sir.
# Conflicts: # hkmc2/shared/src/test/mlscript/ups/MatchResult.mls
# Conflicts: # hkmc2/shared/src/test/mlscript/codegen/BlockPrinter.mls # hkmc2/shared/src/test/mlscript/ups/MatchResult.mls # hkmc2/shared/src/test/mlscript/ups/SimpleTransform.mls # hkmc2/shared/src/test/mlscript/ups/TransformFree.mls
|
|
||
| pattern Value = Abs | ||
|
|
||
| pattern Ctx(pattern Hole) = |
There was a problem hiding this comment.
Don't forget to update this to the new approach (which doesn't require =>) and to use prefix-|.
|
|
||
| :re | ||
| toUppercase of "aXc" | ||
| //│ ═══[RUNTIME ERROR] RangeError: Maximum call stack size exceeded |
There was a problem hiding this comment.
This is what I said didn't work during the meeting. I'm now fixing it.
| pi is @compile IncFst | ||
| //│ = true | ||
|
|
||
| pattern Char = (Str as s where s.length is 1) => s |
There was a problem hiding this comment.
Char should probably be a builtin pattern, right? Otherwise, because of the where clause, I guess it won't behave as expected within compiled string patterns with concatenation.
No description provided.