Liam Appelbe
dff831dbfc
[ffi] Fix callback subtyping test
...
Previously we were reusing the ensureNativeTypeToDartType function to
check that Dart function passed as a callback matches the native type.
This works if the types exactly match, but the subtyping test is
backwards, so it doesn't allow certain cases that should be allowed. The
main case is that when the native function type returns void, the Dart
function should be allowed to return anything.
So I added ensureDartTypeToNativeType, which reverses the subtype test.
As well as making the return types more permissive, this has also
changed what parameters are allowed to be passed to callbacks. For
example, in tests/ffi/vmspecific_static_checks_typeddata_test.dart:80,
passing a Handle to a function expecting an Int8List used to work, but
is now a compile error. I think this change is an improvement, because
previously it would have been possible to pass any type of object to
that callback. So this change turns some potential runtime type errors
into compile errors. But technically I think this is a breaking change.
Fixes: https://github.com/dart-lang/sdk/issues/53659
Bug: https://github.com/dart-lang/sdk/issues/53659
Change-Id: I6846a59fc309ec897cba8f985d7dd0a63b912b42
TEST=tests/ffi/function_callbacks_subtype_test.dart and others
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346440
Commit-Queue: Liam Appelbe <liama@google.com >
Reviewed-by: Daco Harkes <dacoharkes@google.com >
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com >
2024-02-05 03:19:01 +00:00
..
2024-02-05 03:19:01 +00:00
2023-10-11 18:41:57 +00:00
2023-04-12 01:11:05 +00:00
2021-12-24 06:44:34 +00:00
2023-07-03 12:29:15 +00:00
2024-01-31 09:22:45 +00:00
2023-04-12 01:11:05 +00:00
2022-03-10 23:48:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-16 18:41:23 +00:00
2023-04-12 01:11:05 +00:00
2022-05-31 15:36:33 +00:00
2023-04-12 20:32:29 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-10-31 17:11:51 +00:00
2023-10-31 17:11:51 +00:00
2023-12-21 22:35:59 +00:00
2023-12-21 22:35:59 +00:00
2024-02-01 15:30:08 +00:00
2024-02-01 15:30:08 +00:00
2024-01-31 21:43:27 +00:00
2024-01-31 21:43:27 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-11 23:54:59 +00:00
2023-04-12 01:11:05 +00:00
2024-01-18 01:09:49 +00:00
2021-09-02 14:14:35 +00:00
2023-07-14 01:31:38 +00:00
2023-04-12 20:32:29 +00:00
2023-05-02 07:32:30 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 20:32:29 +00:00
2023-05-02 07:32:30 +00:00
2023-05-02 07:32:30 +00:00
2023-01-25 14:08:27 +00:00
2023-11-13 14:25:28 +00:00
2023-06-28 13:06:51 +00:00
2023-04-12 01:11:05 +00:00
2023-05-02 07:32:30 +00:00
2023-12-05 17:25:39 +00:00
2023-09-05 21:47:59 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2023-01-06 07:48:22 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-11 22:24:44 +00:00
2023-04-12 01:11:05 +00:00
2021-03-10 00:42:37 +00:00
2023-04-12 01:11:05 +00:00
2021-07-02 19:06:45 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-11-13 14:25:28 +00:00
2023-07-04 13:10:42 +00:00
2021-06-04 14:26:36 +00:00
2023-04-12 01:11:05 +00:00
2023-11-13 14:25:28 +00:00
2020-10-02 00:54:46 +00:00
2024-01-11 23:54:59 +00:00
2023-09-05 21:47:59 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 20:32:29 +00:00
2023-11-30 23:44:50 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-18 20:56:00 +00:00
2021-02-02 20:04:22 +00:00
2022-09-01 20:36:12 +00:00
2023-06-07 09:49:35 +00:00
2024-01-31 19:32:09 +00:00
2022-09-13 21:16:28 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-31 21:43:27 +00:00
2021-09-02 14:14:35 +00:00
2023-04-12 01:11:05 +00:00
2024-02-02 10:45:27 +00:00
2023-01-16 15:12:38 +00:00
2023-04-12 01:11:05 +00:00
2023-04-20 18:16:09 +00:00
2023-01-16 15:12:38 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2021-07-02 19:06:45 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-11-17 19:02:33 +00:00
2023-09-05 22:15:58 +00:00
2023-11-17 19:02:33 +00:00
2021-10-19 21:25:43 +00:00
2021-10-19 21:25:43 +00:00
2023-11-17 19:02:33 +00:00
2023-12-08 20:20:10 +00:00
2023-04-12 01:11:05 +00:00
2023-09-05 22:15:58 +00:00
2020-12-16 19:07:12 +00:00
2024-01-11 19:12:52 +00:00
2023-06-14 01:38:34 +00:00
2024-01-11 19:12:52 +00:00
2023-06-19 00:25:12 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 20:32:29 +00:00
2023-09-05 22:15:58 +00:00
2023-04-12 20:32:29 +00:00
2023-07-11 15:13:58 +00:00
2023-04-12 01:11:05 +00:00
2023-10-31 17:11:51 +00:00
2023-09-05 21:47:59 +00:00
2023-08-11 16:28:46 +00:00
2023-04-12 20:32:29 +00:00
2022-03-31 06:40:51 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-31 19:24:29 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-25 08:23:51 +00:00
2023-12-11 17:49:58 +00:00
2024-01-26 20:49:09 +00:00
2023-04-12 20:32:29 +00:00
2022-08-17 16:18:35 +00:00
2024-01-31 21:43:27 +00:00
2024-01-31 21:43:27 +00:00
2023-04-12 01:11:05 +00:00
2023-06-08 13:17:28 +00:00
2023-06-08 13:17:28 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-06-08 13:17:28 +00:00
2023-08-18 17:22:18 +00:00
2023-06-09 08:29:30 +00:00
2023-06-08 13:17:28 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-07-04 13:10:42 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 01:11:05 +00:00
2022-05-31 15:36:33 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2022-05-31 15:36:33 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2021-07-02 19:06:45 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 20:32:29 +00:00
2022-03-09 18:02:34 +00:00
2023-04-12 01:11:05 +00:00
2022-03-21 16:47:47 +00:00
2023-04-12 01:11:05 +00:00
2022-03-21 16:47:47 +00:00
2023-04-12 01:11:05 +00:00
2022-03-21 16:47:47 +00:00
2023-04-12 01:11:05 +00:00
2022-03-21 16:47:47 +00:00
2023-04-12 01:11:05 +00:00
2022-03-21 16:47:47 +00:00
2023-04-12 01:11:05 +00:00
2022-03-21 16:47:47 +00:00
2023-04-12 20:32:29 +00:00
2024-01-26 22:08:37 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 01:11:05 +00:00
2024-01-26 18:21:14 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 01:11:05 +00:00
2021-04-01 18:04:12 +00:00
2023-04-12 01:11:05 +00:00
2021-08-12 21:30:10 +00:00
2024-01-11 22:24:44 +00:00
2021-08-12 21:30:10 +00:00
2023-04-12 01:11:05 +00:00
2023-04-12 20:32:29 +00:00
2023-04-12 20:32:29 +00:00