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

[mono] Improve how EnumBuilder handles type attributes #33389

Merged

Conversation

alexischr
Copy link
Contributor

@alexischr alexischr commented Mar 9, 2020

Literally copy set of attributes from

m_underlyingField = m_typeBuilder.DefineField("value__", underlyingType, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
, and mask reserved attributes in FieldBuilder

contributes to #2389

@marek-safar
Copy link
Contributor

This should allow you to re-enable some tests, right?

@akoeplinger
Copy link
Member

The pending Installer Build and Test Windows_NT_x86 Debug is green on AzDO (looks like the updated status didn't make it to GitHub) so feel free to merge after addressing Marek's question.

@lambdageek
Copy link
Member

This should allow you to re-enable some tests, right?

This contributes to #2389 and should allow us to enable S.R.E.Tests.ModuleBuilder.DefineEnum eventually, but right now it will still fail because of the test input that has "a\0b\0c" as the type name.

yield return new object[] { "a\0b\0c", TypeAttributes.Public, typeof(int) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(uint) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(long) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(char) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(bool) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(ulong) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(float) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(double) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(IntPtr) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(UIntPtr) };
yield return new object[] { "Name", TypeAttributes.Public, typeof(Int32Enum) };
}
[Theory]
[ActiveIssue("https://github.com/dotnet/runtime/issues/2389", TestRuntimes.Mono)]
[MemberData(nameof(DefineEnum_TestData))]
public void DefineEnum(string name, TypeAttributes visibility, Type underlyingType)

@alexischr alexischr merged commit 26a1607 into dotnet:master Mar 12, 2020
alexischr added a commit to alexischr/runtime that referenced this pull request Mar 28, 2020
…asses

Follow CoreCLR's example and add the RTSpecialName type attribute to any class field with the 'value__' name when , used as the value store for enumeration class instances.

Second part of the "RTSpecialName fix" that started with dotnet#33389 - before, our behavior was to add the RTSpecialName immediately, as soon as the EnumBuilder was constructed.
Contributes to dotnet#2389
monojenkins pushed a commit to monojenkins/mono that referenced this pull request Mar 28, 2020
…asses

Follow CoreCLR's example and add the RTSpecialName type attribute to any class field with the 'value__' name when , used as the value store for enumeration class instances.

Second part of the "RTSpecialName fix" that started with dotnet/runtime#33389 - before, our behavior was to add the RTSpecialName immediately, as soon as the EnumBuilder was constructed.
Contributes to dotnet/runtime#2389
SamMonoRT pushed a commit that referenced this pull request Apr 3, 2020
…asses (#34212)

Follow CoreCLR's example and add the RTSpecialName type attribute to any class field with the 'value__' name when , used as the value store for enumeration class instances.

Second part of the "RTSpecialName fix" that started with #33389 - before, our behavior was to add the RTSpecialName immediately, as soon as the EnumBuilder was constructed.
Contributes to #2389
SamMonoRT pushed a commit to mono/mono that referenced this pull request Apr 3, 2020
#19349)

…asses

Follow CoreCLR's example and add the RTSpecialName type attribute to any class field with the 'value__' name when , used as the value store for enumeration class instances.

Second part of the "RTSpecialName fix" that started with dotnet/runtime#33389 - before, our behavior was to add the RTSpecialName immediately, as soon as the EnumBuilder was constructed.
Contributes to dotnet/runtime#2389

Co-authored-by: alexischr <alexischr@users.noreply.github.com>
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants