-
Notifications
You must be signed in to change notification settings - Fork 245
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
Conversation
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.
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.
In addition it feels like we should add a test case to the compliance suite. wdyt?
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. |
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... |
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
Merging (with squash)... |
The
UnsafeCast
function can be used to forcefully convert from onetype of jsii proxy value (including
interface{}
) to another jsiiinterface (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.