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

feat(go): add UnsafeCast function #3316

Merged
merged 8 commits into from Jan 12, 2022
Merged

feat(go): add UnsafeCast function #3316

merged 8 commits into from Jan 12, 2022

Conversation

RomainMuller
Copy link
Contributor

The UnsafeCast function can be used to forcefully convert from one
type of jsii proxy value (including interface{}) to another jsii
interface (i.e: a class or interface instance).

If performs a "clean" cast when possible, and creates a new, aliased
proxy otherwise. It is the user's responsibility to ensure they are
passing the correct arguments into the function.

Fixes #2819


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

The `UnsafeCast` function can be used to forcefully convert from one
type of jsii proxy value (including `interface{}`) to another jsii
interface (i.e: a class or interface instance).

If performs a "clean" cast when possible, and creates a new, aliased
proxy otherwise. It is the user's responsibility to ensure they are
passing the correct arguments into the function.
@RomainMuller RomainMuller self-assigned this Jan 4, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 4, 2022
Copy link
Contributor

@MrArnoldPalmer MrArnoldPalmer left a comment

Choose a reason for hiding this comment

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

In addition it feels like we should add a test case to the compliance suite. wdyt?

@mergify
Copy link
Contributor

mergify bot commented Jan 5, 2022

The title of this Pull Request does not conform with [Conventional Commits] guidelines. It will need to be adjusted before the PR can be merged.
[Conventional Commits]: https://www.conventionalcommits.org

@RomainMuller
Copy link
Contributor Author

In addition it feels like we should add a test case to the compliance suite. wdyt?

Good call. It resulted in discovery of an existing runtime bug (would have been impossible to receive "Object@" references in go, as there was no proxy initializer registered for that), and missing kernel features for this to actually work...

@mergify
Copy link
Contributor

mergify bot commented Jan 12, 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 12, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 12, 2022

Merging (with squash)...

@mergify mergify bot merged commit 19da85e into main Jan 12, 2022
@mergify mergify bot deleted the rmuller/go-downcast branch January 12, 2022 01:50
@mergify
Copy link
Contributor

mergify bot commented Jan 12, 2022

Merging (with squash)...

@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Jan 12, 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): downcasting support
2 participants