-
Notifications
You must be signed in to change notification settings - Fork 71
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
core: with-type-constraint #3318
base: alexarice/constraints-v1.5
Are you sure you want to change the base?
core: with-type-constraint #3318
Conversation
I also believe both failing tests are actually bugs exposed by this change rather than bugs with this change |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## alexarice/constraints-v1.5 #3318 +/- ##
==============================================================
- Coverage 90.21% 90.20% -0.01%
==============================================================
Files 459 459
Lines 57655 57654 -1
Branches 5561 5561
==============================================================
- Hits 52011 52008 -3
+ Misses 4202 4201 -1
- Partials 1442 1445 +3 ☔ View full report in Codecov by Sentry. |
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.
On one hand, you're cooking pretty hard indeed, on the other this is great. Probably worth integrating with TypedAttribute[Attribute]
Do you think you could have an inheritance like My goal with |
Not sure if it will show up as the repository is private but see here for an example: I should note that this is really the only actual use case I have, and it could be done with a custom constraint (and needs the corresponding range constraint anyway), as long as the change to verifying property/attribute constraints during inference in the PR is merged |
@math-fehr with the |
From what I recall, Note that I wrote this 2-3 years ago, and I do think this design sucks, so I'm absolutely fine if you want to change some parts of it. |
This is the code I was referring to: Lines 163 to 181 in 61bf632
perhaps this is just checking that the type parameter can be found in the correct place. I'll rebase this in the meantime |
86a33f6
to
c5233b2
Compare
I looked again and |
Would you expect |
I want to add that I've been experimenting with traits like this a bit more, and it's all kind of evil as it all depends on what order you "verify" constraints in. Ideally, I feel that the "verify" methods should not solve any constraints and all solving of constraint variables should be done by a separate system which does not depend on the order of constraints, though this would need a bigger refactor. If anyone has had any ideas on this in general, it would be good to know. |
Sorry I thought I answered this but I forgot to. |
I think we need to provide an actual order on the traits yes. |
As a little update, I had a small discussion with @PapyChacal about how to update the constraint system to avoid these ordering problems and be a bit more xdsl-like (+ hopefully slightly simpler and more performant), but will probably only be able to work on that in a week's time. The constraints in this PR are probably still interesting (at least to me), even if the mechanism for solving them is slightly messy atm. Would we still want to merge this if I could think about how to merge |
Temporary solutions have a tendency to become permanent. A week is not a long time, and I would feel better if we could all be happy with this PR before merging it. If you see a better to implement it in the relatively near future, then let's wait a little bit longer. |
aa7a114
to
1392206
Compare
Rebased onto #3456. I can't remember exactly what we wanted in terms of |
Experiment in using Constraint variables to grab a type from an attribute, and an example of using this for
arith.constant
.Unsure if this a good idea or cooking too hard.
Edit: I also couldn't really figure out how
TypedAttribute
worked, and was not sure if the functionality could be reused (I have use cases in mind where the associated type would not be a parameter)