rust-diplomat / diplomat

Experimental Rust tool for generating FFI definitions allowing many other languages to call Rust code
https://rust-diplomat.github.io/book/
Other
532 stars 51 forks source link

Fix bug in codegen for kotlin arrays of unsigned numeric primitives #685

Closed emarteca closed 2 months ago

emarteca commented 2 months ago

For functions that return a slice of unsigned numeric primitives, the Kotlin code generator would get the return type correct, but be returning a slice of signed primitives instead.

For example:

// for a function fn get_slice<'a>() -> &'a [u8]
// the kotlin generated code would be 

fun getSlice(): UByteArray {
    val returnVal = ...
    return PrimitiveArrayTools.getByteArray(returnVal) // should be getUByteArray
}

This PR fixes the bug.