Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix aop.Select behavior for CloneModuleAsRecord #1993

Merged
merged 2 commits into from
Jun 30, 2021

Conversation

jackkoenig
Copy link
Contributor

@jackkoenig jackkoenig commented Jun 29, 2021

It turns out the behavior of Select differs from what we discussed in dev today, it actually returns the same module multiple times when you have CloneModuleAsRecord clones. Perhaps this isn't what we want, but I decided to add a test (that passed prior to #1974 and failed after it).

We could filter out these duplicates, but I wanted to document the behavior and discuss on this PR.

EDIT:

I have pushed another commit that changes this behavior to the intended behavior

Previously, CloneModuleAsRecord clones would result in the same BaseModule object coming up multiple times when using APIs like .instances, .collectDeep, and .getDeep. This was not the intended behavior and can lead to very subtle bugs.

Contributor Checklist

  • [NA] Did you add Scaladoc to every public function/method?
  • Did you add at least one test demonstrating the PR?
  • Did you delete any extraneous printlns/debugging code?
  • Did you specify the type of improvement?
  • Did you add appropriate documentation in docs/src?
  • Did you state the API impact?
  • Did you specify the code generation impact?
  • Did you request a desired merge strategy?
  • x] Did you add text to be included in the Release Notes for this change?

Type of Improvement

  • bug fix

API Impact

Fixes aop.Select behavior for CloneModuleAsRecord; duplicates of the cloned module will no longer appear.

Backend Code Generation Impact

No impact

Desired Merge Strategy

  • Rebase (and merge commit)

Release Notes

Fixes aop.Select behavior for CloneModuleAsRecord; duplicates of the cloned module will no longer appear.

Reviewer Checklist (only modified by reviewer)

  • Did you add the appropriate labels?
  • Did you mark the proper milestone (3.2.x, 3.3.x, 3.4.x, 3.5.0) ?
  • Did you review?
  • Did you check whether all relevant Contributor checkboxes have been checked?
  • Did you mark as Please Merge?

@jackkoenig jackkoenig added this to the 3.3.x milestone Jun 29, 2021
@jackkoenig jackkoenig requested review from seldridge and azidar June 29, 2021 22:38
seldridge
seldridge previously approved these changes Jun 29, 2021
Copy link
Member

@seldridge seldridge left a comment

Choose a reason for hiding this comment

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

Lol wat. That's some interesting behavior...

Nice test case.

@jackkoenig jackkoenig dismissed seldridge’s stale review June 29, 2021 23:37

I'm going to change the behavior to not return duplicates

@jackkoenig
Copy link
Contributor Author

I don't want to merge this until #1985 is merged

@jackkoenig jackkoenig changed the title Restore aop.Select behavior for CloneModuleAsRecord Fix aop.Select behavior for CloneModuleAsRecord Jun 29, 2021
Previously, CloneModuleAsRecord clones would result in the same
BaseModule object coming up multiple times when using APIs like
.instances, .collectDeep, and .getDeep. This was not the intended
behavior and can lead to very subtle bugs.
@jackkoenig jackkoenig force-pushed the fix-select-clonemoduleasrecord branch from fb73646 to 25a84b5 Compare June 29, 2021 23:55
@jackkoenig jackkoenig merged commit 1bf2d53 into master Jun 30, 2021
@mergify mergify bot added the Backported This PR has been backported label Jun 30, 2021
mergify bot added a commit that referenced this pull request Jun 30, 2021
* Restore aop.Select behavior for CloneModuleAsRecord

(cherry picked from commit 0531cb5)

* Change behavior of aop.Select to not include CloneModuleAsRecord

Previously, CloneModuleAsRecord clones would result in the same
BaseModule object coming up multiple times when using APIs like
.instances, .collectDeep, and .getDeep. This was not the intended
behavior and can lead to very subtle bugs.

(cherry picked from commit 25a84b5)

Co-authored-by: Jack Koenig <koenig@sifive.com>
mergify bot added a commit that referenced this pull request Jun 30, 2021
* Restore aop.Select behavior for CloneModuleAsRecord

(cherry picked from commit 0531cb5)

* Change behavior of aop.Select to not include CloneModuleAsRecord

Previously, CloneModuleAsRecord clones would result in the same
BaseModule object coming up multiple times when using APIs like
.instances, .collectDeep, and .getDeep. This was not the intended
behavior and can lead to very subtle bugs.

(cherry picked from commit 25a84b5)

Co-authored-by: Jack Koenig <koenig@sifive.com>
@jackkoenig jackkoenig deleted the fix-select-clonemoduleasrecord branch June 30, 2021 18:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Backported This PR has been backported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants