Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: generalized imports supporting pattern matching and selective field import #3076
feat: generalized imports supporting pattern matching and selective field import #3076
Changes from 4 commits
b46e72a
e6e9915
67500bf
2d40582
1556274
3b120ee
bcf3fcb
59efd68
957f912
a1ee29c
91c3708
8d7fb3c
8fe6866
ddcef0f
f581947
0eff5af
999d654
c32448f
58c629c
ad314b7
2e9df25
7293902
93dcc88
1a0a069
e72ce22
d43c7ab
3669465
6efb5f6
b109d6d
4c94e00
1eef8dc
e3ee5f1
968cadc
9c911ca
2c3f4aa
2503343
0e0b65a
656b48c
9dc287a
c59e85a
a2aeae4
d0dff31
2d9b797
37b2838
c763ff8
feec77b
988c27f
c98c798
a3ac786
2ae3cbb
3e8226c
b5ed7d0
1ddcf93
95a93a8
ca01c14
af6941a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
why not just
<pat>
=text
?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.
Agreed the syntax here ought to simply be
<pat>
(or<pat_nullary>
).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.
Doesn't that allow tuple patterns and all the other things (wildcard and literals)?
What would those even mean?
Or should we just delegate those to the type-checker (will error out) and accept
_
as a NOP import?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.
8d7fb3c
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.
You could insist the pattern is irrefutable, I think, as with shared function args.
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.
Cool, that's what I do. I have also added tests for it.
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.
@crusso the pattern matches arising from imports have this form
but we have little control about the RHS
(VarE file$lib/ListM.mo)
. What we could do is, when incheck_ir
, detect ids likefile$*
and runcheck (Ir_utils.is_irrefutable p)
on the LHS pattern. Is this what you mean?Well, we know a bit about the RHS, after all. It gets built in
desugar.ml/transform_import
and we can anticipate names. Would it be possible to have anIrrefutableLetD
and insert that intransform_import
?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.
@crusso what about 4c94e00?
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.
Okay now I reuse the coverage check from
typing.ml
but make it an error when its is happening in an error. PTAL! 2d9b797There 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.
JFTR,
<pat>
gives