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

[wip] Allow static self-referential struct type fields in interfaces #111984

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

max-charlamb
Copy link
Contributor

@max-charlamb max-charlamb commented Jan 29, 2025

Treat static struct type fields in interfaces as self-referential, similar to static struct type fields inside of structs.

Resolve #104511

@max-charlamb max-charlamb changed the title add interface check [wip] Allow static self-referential struct type fields in interfaces Jan 29, 2025
@JakeYallop
Copy link
Contributor

Will this also resolve

public struct MyStruct
{
    static ImmutableArray<MyStruct> One;
}

which is also mentioned in the issue as causing a type load exception (a separate issue was closed as a duplicate), but has nothing to do with interfaces.

@kg
Copy link
Member

kg commented Jan 31, 2025

Will this also resolve

public struct MyStruct
{
    static ImmutableArray<MyStruct> One;
}

which is also mentioned in the issue as causing a type load exception (a separate issue was closed as a duplicate), but has nothing to do with interfaces.

That's a different-but-similar problem that might be fixable by making some additional changes to this self-referential type check. We'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.TypeLoadException When Interface Type Contains Static Field/Property for Derived Struct Type
3 participants