uniffi-rs
862e653a - Callback interface via export missing method argument types (#1626)

Commit
2 years ago
Callback interface via export missing method argument types (#1626) * Add a callback method with optional argument to proc-macro tests This fails on Kotlin with: ``` .../uniffi_proc_macro.kt:1523:17: error: unresolved reference: FfiConverterOptionalUInt FfiConverterOptionalUInt.read(argsBuf) ^ ``` on Swift with: ``` .../uniffi_proc_macro.swift:1159:31: error: cannot find 'FfiConverterOptionUInt32' in scope `a`: try FfiConverterOptionUInt32.read(from: &reader) ^~~~~~~~~~~~~~~~~~~~~~~~ ``` and on Python with: ``` thread '<unnamed>' panicked at 'Callback interface method returned unexpected error', /mounted_workdir/uniffi_core/src/lib.rs:245:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Traceback (most recent call last): File "/mounted_workdir/fixtures/proc-macro/tests/bindings/test_proc_macro.py", line 67, in <module> test_callback_interface(PyTestCallbackInterface()) File "/tmp/target/tmp/uniffi-fixture-proc-macro-dc591cf45467586/uniffi_proc_macro.py", line 1625, in test_callback_interface rust_call(_UniFFILib.uniffi_uniffi_proc_macro_fn_func_test_callback_interface, File "/tmp/target/tmp/uniffi-fixture-proc-macro-dc591cf45467586/uniffi_proc_macro.py", line 272, in rust_call return rust_call_with_error(None, fn, *args) File "/tmp/target/tmp/uniffi-fixture-proc-macro-dc591cf45467586/uniffi_proc_macro.py", line 283, in rust_call_with_error uniffi_check_call_status(error_ffi_converter, call_status) File "/tmp/target/tmp/uniffi-fixture-proc-macro-dc591cf45467586/uniffi_proc_macro.py", line 322, in uniffi_check_call_status raise InternalError(msg) uniffi_proc_macro.InternalError: Callback interface method returned unexpected error test uniffi_foreign_language_testcase_test_proc_macro_py ... FAILED ``` * Ensure that type used by callback trait methods are added as known types Previously this didn't happen when the callback trait was exported via `#[uniffi::export(callback_interface)]` rather than in UDL. This fixes the `proc-macro` fixture tests which was broken in Kotlin in the previous commit.
Author
ijc ijc
Parents
Loading