-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix make macro #9147
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
Fix make macro #9147
Conversation
private def get(k: Key, m: List[Key]): Int = | ||
m.count(key => areEquals(key, k)) |
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.
Perhaps we should add an exists
method as well here just to avoid traversing the whole list in L84 below?
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.
Yes and also create another custom method because we only need to differentiate between 0, 1 and >1 appearances in the other cases
m.count(key => areEquals(key, k)) | ||
|
||
private def areEquals(k1: Key, k2: Key): Boolean = | ||
keyEquals(k1, k2) |
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 this needs to be keyEquals(k1, k2) || keyEquals(k2, k1)
?
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.
It shouldn't be needed but the order is important, maybe that was an issue if you tried this version also
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.
Should probably have a test here to catch the "wrong" implementation.
After making this change and publishing locally, it seems the test compilation errors are gone, but now I'm getting a different compilation error in Scala 3 with a very large
|
@pablf Would like to get this in. Can you re-open when conflicts are merged and it's no longer a draft?? 🙏 |
Graph
implementation using aList
instead of aMap
so that possible differences in how scala registers as keys the types are not a problem. I think this should be somewhat faster and could potentially use more memory if there is a lot of redundancy.@kyri-petrou, @RobVermazeren, @strokyl, I don't know if this fixes #9145 because I can't reproduce the issue. The tests for zio and zio-test were passing and I haven't been able to reproduce the issue locally with non-zio repositories. If someone of you could either open a repository with a working example of the issue so I can check what's happening or try this version locally, that would be really helpful!
Respect to the @butcherless issue, your error can only appear once the layer construction has been correct, so it isn't entirely related. I have added a fix for that. I don't know if it's the more appropriate as the layer construction is a bit more complex than before and can't be printed in such a nice way.