Skip to content
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

Support for annotations #247

Draft
wants to merge 1 commit into
base: hkmc2
Choose a base branch
from

Conversation

chengluyu
Copy link
Member

I'm trying to support annotations. As we discussed, recursive pattern normalization/compilation should be an opt-in feature and can be enabled by an annotation. For example,

fun foo(xs) = if xs is
  @compile EmailList(values) then ...
  ...

I have only completed parsing as the first step. I am still not sure how it should be handled in the Elaborator, so I put this PR in draft status.

@LPTK
Copy link
Contributor

LPTK commented Dec 4, 2024

For reference, the PR where this was implemented in the previous version of the compiler by @CAG2Mark: #210

if blk.isEmpty then
err((msg"Expected ${subRule.whatComesAfter} ${subRule.mkAfterStr}; found end of block instead" -> S(loc) :: Nil))
errExpr
blk ::: blockContOf(rule)
blk ::: blockContOf(rule) // TODO: apply headAnnotations
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a fan of this. We're going to be silently dropping some information, which is always the worst to debug, if/when we eventually look into why this case is not working.

Do you have a test case that reproduces this path?

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