Skip to content
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

RFC: Fix delegation for *Dict functions returning the underlying *Dict #253

Merged
merged 2 commits into from
Jan 17, 2017

Conversation

kmsquire
Copy link
Member

@kmsquire kmsquire commented Jan 16, 2017

  • When called on an Associative container, sizehint!, empty!, and
    setindex! all return the container
  • The @delegate macro is not aware of this, and instead returned
    the wrapped object when used to define, e.g., DefaultDicts
  • Fixed by creating a second macro, @delegate_return_parent,
    which works like @delegate, but returns the parent container.

Edit: delete! also returns the container.

@kmsquire
Copy link
Member Author

I noticed this while working on #252. Should be uncontroversial, but I'm open to suggestions for alternative fixes, if anyone has any suggestions.

@codecov-io
Copy link

codecov-io commented Jan 16, 2017

Current coverage is 92.92% (diff: 100%)

Merging #253 into master will increase coverage by 0.04%

@@             master       #253   diff @@
==========================================
  Files            31         31          
  Lines          2485       2486     +1   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           2308       2310     +2   
+ Misses          177        176     -1   
  Partials          0          0          

Powered by Codecov. Last update 0d99898...cceaebd

* When called on an Associative container, delete!, empty!, sizehint!
  and setindex! all return the container
* The `@delegate` macro is not aware of this, and instead returned
  the wrapped object.
* Fixed by creating a second macro, `@delegate_return_parent`,
  which works like `@delegate`, but returns the parent container.
* delete!
* empty!
* setindex!
* sizehint!
@kmsquire kmsquire merged commit 5a13308 into master Jan 17, 2017
@kmsquire kmsquire deleted the kms/fix_delegation branch July 13, 2017 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants