Fix for two logic errors regarding C return type vs Kotlin return type.

The return types are different because Kotlin converts C output params
to a returned object.

The C call (auto result =...) needs to consider the C return type.

The Kotlin return needs to consider the Kotlin method return type.

Test: Manual
Bug: 372840610
Change-Id: I1c15a4bf12eaa6e2c3e7955d92e1cef88f7dfd97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/210498
Reviewed-by: Alex Benton <bentonian@google.com>
Commit-Queue: Alex Benton <bentonian@google.com>
diff --git a/generator/templates/art/methods.cpp b/generator/templates/art/methods.cpp
index b6dc588..a9c9c0c 100644
--- a/generator/templates/art/methods.cpp
+++ b/generator/templates/art/methods.cpp
@@ -146,7 +146,7 @@
             {{ as_cType(_kotlin_return.type.name) }} out = {};
             args.{{ as_varName(_kotlin_return.name) }} = &out;
         {% endif %}
-        {{ 'auto result =' if _kotlin_return.type.name.get() != 'void' }}
+        {{ 'auto result =' if method.return_type.name.get() != 'void' }}
         {% if object %}
             wgpu{{ object.name.CamelCase() }}{{ method.name.CamelCase() }}(handle
         {% else %}
@@ -157,7 +157,7 @@
             {% endfor %}
         );
         if (env->ExceptionCheck()) {  //* Early out if client (Kotlin) callback threw an exception.
-            return {{ '0' if method.return_type.name.get() != 'void' }};
+            return {{ '0' if  _kotlin_return.type.name.get() != 'void' }};
         }
         {% if method.return_type.name.canonical_case() == 'status' %}
             if (result != WGPUStatus_Success) {