-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement "meta patteriables" #198
Conversation
…taPat in PatMatcher
Codecov Report
@@ Coverage Diff @@
## main #198 +/- ##
============================================
- Coverage 79.66% 79.43% -0.23%
- Complexity 2078 2087 +9
============================================
Files 197 197
Lines 6555 6657 +102
Branches 793 808 +15
============================================
+ Hits 5222 5288 +66
- Misses 936 965 +29
- Partials 397 404 +7
Continue to review full report at Codecov.
|
✌️ imkiva can now approve this pull request. To approve and merge a pull request, simply reply with |
bors merge |
Remember to resolve all conversations before merging as they are hard requirements |
Build succeeded: |
Fix #81, oh my glob.
Summary
Split into five sections.
Refactorings
CoreDistiller::visitMaybeCtorPatterns
. There are some others, I can't remember.BaseDistiller::visitCalls
, added a new boolean parameter for implicitness option. This is because sometimes it'sShowImplicitArgs
, sometimes it'sShowImplicitPats
.Pat
with pattern matching (JEP 406) and deletedPat.Visitor
the abstract visitor along with all thedoAccept
methods.Behavioural improvements
Now we also
zonk
the types of the patterns afterelabClauses
. We didn't do this before, but it so far didn't cause any problem. I conjecture that patterns' types are never used after their type checking, but I'm not exactly sure (I'm 95% sure). If they really aren't used, we probably don't have to zonk them, and we probably want to remove them for spatial efficiency. /cc @imkivaNew features
Pat.Meta
for "unknown patterns", which are translated intoRefTerm.MetaPat
(also new) inPatToTerm
. The idea behind these two structures are similar to "meta variables" but for patterns.zonk
for meta patteriables isPat::inline
-- they inline the solutions of meta patteriables. When no solution, we turn them into bind patterns. So,Pat::inline
is total, thus no need to have an error reporter.PatMatcher
, we may encounter problems like "matching a patternp
with an instance ofRefTerm.MetaPat
". In this case, we "solve" the meta patteriable as a renamed version ofp
. Yes, the renamer for patterns is also added.inline
the patterns, which is like freezing the meta patteriables. Solved meta patteriables are inlined as their solutions.CalmFace
patterns are now tycked as meta patterns. They will causeUnsupportedOperationException
before.MetaPat
appearing in the types of unifications). They were generated as bind patterns before.Assumptions
RefTerm.MetaPat
inPatMatcher
inPatTycker
. Other invocations toPatMatcher
will not. Therefore, we made the newLocalCtx
parameter ofPatMatcher
nullable, because we need to modify thelocalCtx
in the type checking of patterns.Tests
Modified the redblack tree showcase with all manual implicit refinement removed. It works perfectly. Now the exact Agda code can be translated to Aya, with every omittable pattern omitted. One exception is that I discovered a case when you match on two
{black}
patterns, you don't need to split arbBlack a x b
pattern. I decided to keep this code to make the code shorter afterall.Sorry for my English.