-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[docs/ffi] .address
position should mention .cast()
#56613
Comments
Summary: The analyzer incorrectly throws an |
I found the root cause of this issue and i actually tried to fix this, but i planned to fix this seperately once i landed this |
.address
position error for native call if called with undefined getters.address
position error for native call if called with undefined getters
.address
position error for native call if called with undefined getters.address
position error for native leaf call if called with undefined getters
(am not good at writing issue title, feel free to edit) |
I had a thought while reasoning about this issue, we recently "supported" But i think thats a existing "bug" which we just fixed (i.e its not something we added to support, it should have worked before) Because as far as i understand "Address Position" Error, We are only allowing .address on leaf native call. From the above statement, Also we should allow If we dont allow such these expression Feel free to correct me. @dcharkes |
Requested CL (this is my first direct cl which was created through
|
It should be like this. |
I think we would expect two errors here. They are separate errors, not one error causing the next error. You could compare it for example to trying to call a private method in Java or C++ and passing the wrong argument type to that method. You'd get an error that the method is private, and that the argument type is wrong. I think Or maybe it should not be in the error message itself, but in the dartdoc comment of |
Well, now it makes sense. Then analyzer is doing the right job, but cfe is the one still buggy. We can close this and track the cfe issue in new issue ticket? |
Thanks @dcharkes for clearing this, i think updating this error message would clearly indicate its purpose. |
You can just make a PR without a bug report if you want to work on it right away. It saves who follow the bug reports on this repository an email. 😉
We can update this issue to make it track updating the docs. |
.address
position error for native leaf call if called with undefined getters.address
position should mention .cast()
Btw, am just trying to understand the issue, Any previous references or issue regarding this also helps me to understand. |
You can find references in the following way:
|
When constructing new |
Where is it being set to null? Why is it being set to null? Please add a reference to the code that does it. |
I faced consequence of this as an issue while reporting cfe error, where after this transformation, node.location?.file |
Maybe @jensjoha or @chloestefantsova knows the answer to this. |
Seems location is not intentionally set to "null", but it is a getter which will get its location based on its parent, but |
The constructed |
… ffi Currently, we just "removed" the actual expression by transforming to `InvalidExpression('Invalid Type')` if a expression is Invalid. But this could cascade `.address` position errors (i.e transformer no longer able to walk `.address.abc` if the expression is just replaced with empty expression). So unwrapping actual expression from `InvalidExpression` and trying to transforming that actual expression through a recursive call. TEST=tests/ffi/static_checks/address_position_cascade_test.dart Bug: #56613 Change-Id: Ib1ba1d5021797b645c29ac296752d844d0935964 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/384080 Reviewed-by: Daco Harkes <[email protected]> Reviewed-by: Slava Egorov <[email protected]> Commit-Queue: Slava Egorov <[email protected]>
Hi @dcharkes, Any update on updating docs? |
TODO
.address
should mention or show an example of using.cast()
.ADDRESS_POSITION
documentation should mention.cast()
.Original bug report:
While trying to fix this,
I found the below code is
throws 2 errors by the analyzer
But expected is only one error
FYI @dcharkes
The text was updated successfully, but these errors were encountered: