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

[cs] issues with Dynamic type parameters on interfaces #8497

Closed
nadako opened this issue Jun 30, 2019 · 2 comments · Fixed by #11551
Closed

[cs] issues with Dynamic type parameters on interfaces #8497

nadako opened this issue Jun 30, 2019 · 2 comments · Fixed by #11551
Assignees
Labels
bug platform-cs Everything related to c#
Milestone

Comments

@nadako
Copy link
Member

nadako commented Jun 30, 2019

interface I<T> {
	function f():I<T>;
}

class C implements I<Any> {
	public function f():I<Any> return null;
}

class C2 implements I<Dynamic> {
	public function f():I<Dynamic> return null;
}

C gives this native compilation error:

error CS0539: 'global::I<...>.f' in explicit interface declaration is not a member of interface

because it generates

global::I global::I<object>.f() {

while I<object>.f is required to return I<object>, not I


and C2 gives this:

error CS0738: 'C2' does not implement interface member 'I<object>.f()'. 'C2.f()' cannot implement 'I<object>.f()' because it does not have the matching return type of 'I<object>'

which is a similar error (using I instead of I<object>), just the f is not using explicit interface implementation, so the error message is different.


What I don't quite understand yet is why generated code for Dynamic is different from Any, but I guess it's related to Dynamic variance?

I'm not hopeful, but maybe @waneck has some time to look into this? :)

@nadako nadako added bug platform-cs Everything related to c# labels Jun 30, 2019
@nadako nadako added this to the Bugs milestone Jun 30, 2019
@nadako
Copy link
Member Author

nadako commented Jun 30, 2019

(this is NOT a regression - same result on 3.4.7)

@kLabz
Copy link
Contributor

kLabz commented Jul 1, 2019

Note: works fine if I is @:nativeGen

@Simn Simn modified the milestones: Bugs, Later Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug platform-cs Everything related to c#
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants