-
Notifications
You must be signed in to change notification settings - Fork 246
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
(rosetta) type inference is not sufficiently narrowed causing incorrect Python translations #3029
Comments
The workaround is to declare the second parameter as a separate variable with an explicit type before passing it into the method. |
Yeah so for some reason that last parameter seems interpreted as a property bag, whereas the type signature of the method suggests it cannot be that (it should only happen if the last parameter is known to be a struct). |
Oh this is fun. The type of this argument is |
|
Try and resolve the containing function call. If it resolves, we know the `any` the typechecker is giving us is actually intended to be an `any`. If the containing call does not resolve, we'll treat it as an unknown type of an uncompiling sample, and assume there's a struct there. Fixes #3029. --- By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license]. [Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
) Rosetta automatic snippet translation is doing a poor job of snippet translation. This is mainly because the snippets are not compilable. Update snippets to make them compilable and translate correctly. Additionally, make the rosetta compilation strict and run during the build step. There are still a few more translation errors, but these are arising from bugs in rosetta. aws/jsii#3026 aws/jsii#3029 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…#16801) Rosetta automatic snippet translation is doing a poor job of snippet translation. This is mainly because the snippets are not compilable. Update snippets to make them compilable and translate correctly. Additionally, make the rosetta compilation strict and run during the build step. There are still a few more translation errors, but these are arising from bugs in rosetta. aws/jsii#3026 aws/jsii#3029 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
🐛 Bug Report
Given the method signature -
and the snippet that uses this method as -
This gets incorrectly translated into Python as -
Real life example -
The text was updated successfully, but these errors were encountered: