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

fix(go): unable to reuse instances between child/parent interfaces #3321

Merged
merged 2 commits into from
Jan 26, 2022

Conversation

RomainMuller
Copy link
Contributor

The go runtime was not tracking aliases in a way that enabled it to
return an alternate proxy to an object instance when that had previously
been returned as a different, singular interface.

This change keeps tack of the "first ever" registered instance against a
given InstanceID (as this is likely the one that was natively
constructed), but also to all proxy aliases to the same InstanceID, so
that it can later return an existing proxy that can be converted to a
desired type.

Fixes #2688


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@RomainMuller RomainMuller self-assigned this Jan 6, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 6, 2022
@RomainMuller
Copy link
Contributor Author

Marked as draft because this builds on top of #3316 (will mark as "ready for review" once that has shipped).

@RomainMuller RomainMuller changed the title feat(go): add UnsafeCast function fix(go): unable to reuse instances between child/parent interfaces Jan 11, 2022
Base automatically changed from rmuller/go-downcast to main January 12, 2022 01:50
The go runtime was not tracking aliases in a way that enabled it to
return an alternate proxy to an object instance when that had previously
been returned as a different, singular interface.

This change keeps tack of the "first ever" registered instance against a
given InstanceID (as this is likely the one that was natively
constructed), but also to all proxy aliases to the same InstanceID, so
that it can later return an existing proxy that can be converted to a
desired type.

Fixes #2688
@RomainMuller RomainMuller marked this pull request as ready for review January 12, 2022 09:06
@mergify
Copy link
Contributor

mergify bot commented Jan 26, 2022

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Jan 26, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 26, 2022

Merging (with squash)...

@mergify mergify bot merged commit 70be636 into main Jan 26, 2022
@mergify mergify bot deleted the rmuller/go-reuse-iface-refs branch January 26, 2022 18:56
@mergify
Copy link
Contributor

mergify bot commented Jan 26, 2022

Merging (with squash)...

@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go: unable to reuse instances between child/parent interfaces
2 participants