MichalStrehovsky / iltrim

MIT License
9 stars 1 forks source link

Keep fields on enums #74

Closed mateoatr closed 2 years ago

mateoatr commented 2 years ago

Should fix #67. Test is failing here:

https://github.com/MichalStrehovsky/iltrim/blob/39fbd923f2b02c9d8ae0751354d71b288649f3be/src/coreclr/tools/ILTrim/ILTrim.Tests/TestCasesRunner/AssemblyChecker.cs#L272-L275

With:

 Message: 
Field 'Mono.Linker.Tests.Cases.Basic.MyEnum Mono.Linker.Tests.Cases.Basic.MyEnum::A' value doesn's match. Expected 0, actual 0
Expected: True
Actual:   False

Looks like Cecil simply compares the two underlying objects. I have no idea why this comparison might be failing. Any ideas on what's going on here?

MichalStrehovsky commented 2 years ago

We did the constant values that this is complaining about in #27. I don't see anything obviously wrong in that pull request. Can you look with ILDASM at the fields on enum before/after rewriting if you see something wrong with it?

I can help if you don't know where to look.

mateoatr commented 2 years ago

We did the constant values that this is complaining about in #27. I don't see anything obviously wrong in that pull request. Can you look with ILDASM at the fields on enum before/after rewriting if you see something wrong with it?

I can help if you don't know where to look.

These literally look the same before/after:

.class public auto ansi sealed Mono.Linker.Tests.Cases.Basic.MyEnum
       extends [System.Runtime]System.Enum
{
  .field public specialname rtspecialname int32 value__
  .field public static literal valuetype Mono.Linker.Tests.Cases.Basic.MyEnum A = int32(0x00000000)
  .field public static literal valuetype Mono.Linker.Tests.Cases.Basic.MyEnum B = int32(0x00000001)
  .field public static literal valuetype Mono.Linker.Tests.Cases.Basic.MyEnum C = int32(0x00000002)
} // end of class Mono.Linker.Tests.Cases.Basic.MyEnum
MichalStrehovsky commented 2 years ago

This was a bug in the test infra port. Sorry I didn't get to helping you earlier. VerifyField looks a bit different in the linker repo.