Can't define implicit conversion

public class TestClass {
    public static void test() {
        // If the int->gint implicit conversion is not defined as below, here will be an compile error:
        // (E62) Type mismatch, cannot assign "Int32" to "gint"
        gint a = 5;

        // If the gint->int implicit conversion is not defined as below, here will be an compile error:
        // (E486) Parameter 1 is "gint", should be "Int32", in call to static void TestClass.doSth(Int32 value)
        doSth(a);
    }

    public static void doSth(int value) {
    }
}

public __mapped struct gint => Foundation.NSInteger {

    private int? v => __mapped;

    // (E140) An implicit conversion from "Int32" to "gint" already exists
    public static implicit operator gint(int r) {
        return (Foundation.NSInteger)r;
    }

    // (E140) An implicit conversion from "gint" to "Int32" already exists
    public static implicit operator int(gint g) {
        return g.v;
    }
}

Elements 8.3.92.1905

Isn’t that the wrong way around? ie shouldn’t that be

 public static implicit operator gint(int g){
...
    }

Oh sorry for my mistake…I’ve corrected the test code.

Thanks, logged as bugs://74082

This bug breaks my unit tests for iOS for a long time. Could it be prioritized?

This seems to work after my other nullable change.

bugs://74082 got closed with status fixed.

Hi Carlo, is this fixed in 8.3.90.1953? It can still be reproduced, and it’s not in the bugfix list.

It probably was fixed post-build, if it was not listed in the change log. Unfortunately I cannot check right now, I’m AFK and don’t have git access from the iPad :wink:

8.3.90.1957 is a gamma version which still doesn’t include this bugfix. Did I miss something?

bugs://74082 got reopened.

No idea. It was supposed to be fixed. I’ve reopened the issue to be looked at again.

@esword: I just tried compiling the exact code pasted above and that compiles in latest (ie fridays build). What am I missing?

That’s weird. I’m just using the lateast 8.3.90.1957 to test the same code, but the errors are still there and nothing’s changed.

maybe there’s more in your project? Can you send the full project?

Just create a new and clean project:
EmptyProject1.zip (128.6 KB)

bugs://74082 got closed with status fixed.

This is quite odd, thats the same as I had but it didn’t show it. Anyway it’s fixed now. Thanks!