Skip to content

Does dart:ffi Handle have an implicit conversion to bool? #52530

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

Closed
eseidel opened this issue May 26, 2023 · 1 comment
Closed

Does dart:ffi Handle have an implicit conversion to bool? #52530

eseidel opened this issue May 26, 2023 · 1 comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior library-ffi

Comments

@eseidel
Copy link
Contributor

eseidel commented May 26, 2023

https://api.dart.dev/stable/3.0.2/dart-ffi/Handle-class.html

Based on usage in Flutter it appears to:
https://github.com/flutter/engine/blob/main/lib/ui/platform_dispatcher.dart#L207
https://github.com/flutter/engine/blob/main/lib/ui/platform_dispatcher.dart#L209

But that's not at all clear from the docs.

(This came up because I appear to have broken this implicit conversion in my FFI hacking, which is likely my bug, but might also just be some bug/quirk in existing FFI that I somehow broke?)
shorebirdtech/shorebird#532 (comment)

@lrhn lrhn added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi labels May 26, 2023
@dcharkes
Copy link
Contributor

Handle <-> Object, bool is a valid subtype of Object.

This logic is inconsistent with asFunction because of historical reasons. (@FfiNatives are meant to replace the old native syntax, and that allowed declaring a subtype of the C type.) This is tracked in:

@a-siva a-siva added the closed-as-intended Closed as the reported issue is expected behavior label Nov 30, 2023
@a-siva a-siva closed this as completed Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-as-intended Closed as the reported issue is expected behavior library-ffi
Projects
None yet
Development

No branches or pull requests

4 participants