-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
bugSomething isn't workingSomething isn't workinggeneratorhelp wantedExtra attention is neededExtra attention is needed
Description
To reproduce: in a #nullable enable C# source (e.g. OutParameterTests.cs in this repo) add methods similar to:
public void Return_StringArray_NotNull(out string[] returnValues) {
returnValues = [];
}
public void Return_StringArray_Optional(out string[]? returnValues) {
returnValues = null;
}The C and Swift generated code have the correct nullability annotations.
However, generated Kotlin methods have mismatched parameter declarations (DNNullableArray<>) vs. their bodies (using DNArray<>), e.g.:
open fun return_StringArray_NotNull(returnValues: ObjectRef<DNNullableArray<System_String>> /* System.String[] */) {
val __returnValuesJNAByRef = returnValues.toJNARef()
val __exceptionC = PointerByReference()
CAPI.Beyond_NET_Sample_Source_OutParameterTests_Return_StringArray_NotNull(this.__handle, __returnValuesJNAByRef, __exceptionC)
val __exceptionCHandle = __exceptionC.value
if (__exceptionCHandle != null) {
throw System_Exception(__exceptionCHandle).toKException()
}
returnValues.value = DNArray<System_String>(System_String, __returnValuesJNAByRef.value)
}
open fun return_StringArray_Optional(returnValues: ObjectRef<DNNullableArray<System_String>?> /* System.String[] */) {
val __returnValuesJNAByRef = returnValues.toJNARef()
val __exceptionC = PointerByReference()
CAPI.Beyond_NET_Sample_Source_OutParameterTests_Return_StringArray_Optional(this.__handle, __returnValuesJNAByRef, __exceptionC)
val __exceptionCHandle = __exceptionC.value
if (__exceptionCHandle != null) {
throw System_Exception(__exceptionCHandle).toKException()
}
returnValues.value = if (__returnValuesJNAByRef.value != null) DNArray<System_String>(System_String, __returnValuesJNAByRef.value) else null
}This leads to compilation failures similar to:
Generated_Kotlin.kt:179541:24 Assignment type mismatch: actual type is 'DNArray<System_String>', but 'DNNullableArray<System_String>' was expected.
Generated_Kotlin.kt:179560:24 Assignment type mismatch: actual type is 'DNArray<System_String>?', but 'DNNullableArray<System_String>?' was expected.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggeneratorhelp wantedExtra attention is neededExtra attention is needed