Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[generator] Support for generic classes in our block trampolines #8993

Open
dalexsoto opened this issue Jul 2, 2020 · 0 comments
Open

[generator] Support for generic classes in our block trampolines #8993

dalexsoto opened this issue Jul 2, 2020 · 0 comments
Labels
bug If an issue is a bug or a pull request a bug fix generator Issues affecting the generator iOS Issues affecting iOS
Milestone

Comments

@dalexsoto
Copy link
Member

dalexsoto commented Jul 2, 2020

Binding UIKit brought some generic classes into the mix of our blocks support, see https://github.com/xamarin/xamarin-macios/pull/8992/files#diff-1ca9e8e46629c0f8806cee2c8be4aad3R22727-R22764.

Here is a proposed test case but we can adjust as needed.

    delegate T HelloGenericDelegate<T> () where T : NSObject;
    delegate T HelloGenericDelegate2<T> (T t1) where T : NSObject;
    delegate T1 HelloGenericDelegate3<T1, T2> (T1 t1, T2 t2) where T1 : NSObject where T2 : NSObject;
    delegate T1 HelloGenericDelegate4<T1, T2> (T1 t1, T2 t2, [BlockCallback] HelloGenericDelegate2<T1> otherBlock) where T1 : NSObject where T2 : NSObject;

    [BaseType(typeof(NSObject))]
    interface OneGenericType<T1>
        where T1 : NSObject
    {

    }

    [BaseType(typeof(NSObject))]
    interface Example<T1>
        where T1 : NSObject
    {

        [NullAllowed, Export("one", ArgumentSemantic.Copy)]
        Func<T1, bool> One { get; set; }

        [NullAllowed, Export("two", ArgumentSemantic.Copy)]
        Action<T1> Two { get; set; }

        [NullAllowed, Export("three", ArgumentSemantic.Copy)]
        Func<T1, OneGenericType<T1>, OneGenericType<T1>> Three { get; set; }

        [NullAllowed, Export("four", ArgumentSemantic.Copy)]
        HelloGenericDelegate<T1> Four { get; set; }

        [NullAllowed, Export("five", ArgumentSemantic.Copy)]
        HelloGenericDelegate2<T1> Five { get; set; }
    }

    interface TwoGenericsType<T1, T2>
        where T1 : NSObject
        where T2 : NSObject
    {
        
    }

    [BaseType(typeof(NSObject))]
    interface ExampleTwo<T1, T2>
        where T1 : NSObject
        where T2 : NSObject
    {

        [NullAllowed, Export("one", ArgumentSemantic.Copy)]
        Func<T1, bool, T2> One { get; set; }

        [NullAllowed, Export("two", ArgumentSemantic.Copy)]
        Action<T1, T2> Two { get; set; }

        [NullAllowed, Export("three", ArgumentSemantic.Copy)]
        Func<T1, T2, TwoGenericsType<T1, T2>, TwoGenericsType<T1, T2>> Three { get; set; }

        [NullAllowed, Export("four", ArgumentSemantic.Copy)]
        HelloGenericDelegate3<T1, T2> Four { get; set; }

        [NullAllowed, Export("five", ArgumentSemantic.Copy)]
        HelloGenericDelegate4<T1, T2> Five { get; set; }
    }
@dalexsoto dalexsoto added bug If an issue is a bug or a pull request a bug fix iOS Issues affecting iOS generator Issues affecting the generator labels Jul 2, 2020
@dalexsoto dalexsoto added this to the xcode12 milestone Jul 2, 2020
@dalexsoto dalexsoto changed the title [generator] Support for generic clases in out block trampolines [generator] Support for generic clases in our block trampolines Jul 2, 2020
@rolfbjarne rolfbjarne changed the title [generator] Support for generic clases in our block trampolines [generator] Support for generic classes in our block trampolines Jul 3, 2020
@rolfbjarne rolfbjarne modified the milestones: xcode12, Future Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug If an issue is a bug or a pull request a bug fix generator Issues affecting the generator iOS Issues affecting iOS
Projects
None yet
Development

No branches or pull requests

2 participants