-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Be much more intelligent about splitting matches #1543
Conversation
plugins/hls-tactics-plugin/test/golden/SplitPattern.hs.expected
Outdated
Show resolved
Hide resolved
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.
lgtm if it does for you
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.
Thank you for refactorings in graftWith*
families. I like them!
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.
LGTM 👍
Wingman used to implement case split by guessing where in the AST the match group was, and then annotating from there. But this had lots of problems --- it wouldn't work in
where
bindings, orclass
defaults. And I'd hand-coded support forinstance
methods, but due to a bug it would reformat the entire declaration.This PR adds some new
syb
traversals that let us target very specific parts of the AST. For example, it's now possible to target "the smallest MatchGroup that contains a given source span," and then run a list-bind over itsMatch
es. The machinery is reusable for other purposes, and makes theGraft
system more composable.Fixes #1542
Fixes #1541
Fixes #1516