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

Update ICSharpCode.Decompiler to 7.2.1.6856 (#67875) #69065

Merged
merged 3 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<DiffPlexVersion>1.5.0</DiffPlexVersion>
<FakeSignVersion>0.9.2</FakeSignVersion>
<HumanizerCoreVersion>2.14.1</HumanizerCoreVersion>
<ICSharpCodeDecompilerVersion>7.1.0.6543</ICSharpCodeDecompilerVersion>
<ICSharpCodeDecompilerVersion>7.2.1.6856</ICSharpCodeDecompilerVersion>
<InputSimulatorPlusVersion>1.0.7</InputSimulatorPlusVersion>
<MicrosoftBuildLocatorVersion>1.5.5</MicrosoftBuildLocatorVersion>
<MicrosoftExtensionsDependencyInjectionVersion>6.0.0</MicrosoftExtensionsDependencyInjectionVersion>
Expand Down
27 changes: 26 additions & 1 deletion src/Compilers/Test/Core/CompilationVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,32 @@ public string DumpIL()
/// <param name="expected">The expected IL</param>
public void VerifyTypeIL(string typeName, string expected)
{
VerifyTypeIL(typeName, output => AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, output, escapeQuotes: false));
VerifyTypeIL(typeName, output =>
{
// All our tests predate ilspy adding `// Header size: ...` to the contents. So trim that out since we
// really don't need to validate superfluous IL comments
expected = RemoveHeaderComments(expected);
output = RemoveHeaderComments(output);

output = FixupCodeSizeComments(output);

AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, output, escapeQuotes: false);
});
}

private static readonly Regex s_headerCommentsRegex = new("""^\s*// Header size: [0-9]+\s*$""", RegexOptions.Multiline);
private static readonly Regex s_codeSizeCommentsRegex = new("""^\s*// Code size(:) [0-9]+\s*""", RegexOptions.Multiline);

private static string RemoveHeaderComments(string value)
{
return s_headerCommentsRegex.Replace(value, "");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are already doing this, could we also remove the colon from // Code size: 6 (0x6) comments to reduce the diffs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's nto the worst idea :) But the works already been done. so i'd prefer to keep as is :)

Copy link
Contributor

@RikkiGibson RikkiGibson Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand which IL baselines are impacted here. Basically, for a change like this I'd expect many many more baselines to be impacted. Is the issue that we use ildasm in some places and ICSharpCode.Decompiler in other places? I'm concerned about the inconsistency in baselines and about ongoing PRs being disrupted by the change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i'm not sure what a good strategy is here. As long as the compiler is using this tool, and as long as this tool changes their outpus across releases, then we have this problem.

}

private static string FixupCodeSizeComments(string output)
{
// We use the form `// Code size 7 (0x7)` while ilspy moved to the form `// Code size: 7 (0x7)` (with an
// extra colon). Strip the colon to make these match.
return s_codeSizeCommentsRegex.Replace(output, match => match.Groups[0].Value.Replace(match.Groups[1].Value, ""));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace Microsoft.CodeAnalysis.Editor.UnitTests.MetadataAsSource
[UseExportProvider]
public abstract partial class AbstractMetadataAsSourceTests : IAsyncLifetime
{
protected static readonly string ICSharpCodeDecompilerVersion = "7.1.0.6543";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge deal, but can't this code just read the version number from the file?

protected static readonly string ICSharpCodeDecompilerVersion = "7.2.1.6856";

public virtual Task InitializeAsync()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,167 +208,166 @@ public struct [|ValueTuple|] : IEquatable<ValueTuple>, IStructuralEquatable, ISt
using System.Collections;
using System.Runtime.InteropServices;

namespace System
namespace System;

[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct [|ValueTuple|] : IEquatable<ValueTuple>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple>, ITupleInternal
{{
[StructLayout(LayoutKind.Sequential, Size = 1)]
public struct [|ValueTuple|] : IEquatable<ValueTuple>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple>, ITupleInternal
int ITupleInternal.Size => 0;

public override bool Equals(object obj)
{{
int ITupleInternal.Size => 0;
return obj is ValueTuple;
}}

public override bool Equals(object obj)
{{
return obj is ValueTuple;
}}
public bool Equals(ValueTuple other)
{{
return true;
}}

public bool Equals(ValueTuple other)
{{
return true;
}}
bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
{{
return other is ValueTuple;
}}

bool IStructuralEquatable.Equals(object other, IEqualityComparer comparer)
int IComparable.CompareTo(object other)
{{
if (other == null)
{{
return other is ValueTuple;
return 1;
}}

int IComparable.CompareTo(object other)
if (!(other is ValueTuple))
{{
if (other == null)
{{
return 1;
}}
throw new ArgumentException(SR.ArgumentException_ValueTupleIncorrectType, ""other"");
}}

if (!(other is ValueTuple))
{{
throw new ArgumentException(SR.ArgumentException_ValueTupleIncorrectType, ""other"");
}}
return 0;
}}

return 0;
}}
public int CompareTo(ValueTuple other)
{{
return 0;
}}

public int CompareTo(ValueTuple other)
int IStructuralComparable.CompareTo(object other, IComparer comparer)
{{
if (other == null)
{{
return 0;
return 1;
}}

int IStructuralComparable.CompareTo(object other, IComparer comparer)
if (!(other is ValueTuple))
{{
if (other == null)
{{
return 1;
}}

if (!(other is ValueTuple))
{{
throw new ArgumentException(SR.ArgumentException_ValueTupleIncorrectType, ""other"");
}}

return 0;
throw new ArgumentException(SR.ArgumentException_ValueTupleIncorrectType, ""other"");
}}

public override int GetHashCode()
{{
return 0;
}}
return 0;
}}

int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
{{
return 0;
}}
public override int GetHashCode()
{{
return 0;
}}

int ITupleInternal.GetHashCode(IEqualityComparer comparer)
{{
return 0;
}}
int IStructuralEquatable.GetHashCode(IEqualityComparer comparer)
{{
return 0;
}}

public override string ToString()
{{
return ""()"";
}}
int ITupleInternal.GetHashCode(IEqualityComparer comparer)
{{
return 0;
}}

string ITupleInternal.ToStringEnd()
{{
return "")"";
}}
public override string ToString()
{{
return ""()"";
}}

public static ValueTuple Create()
{{
return default(ValueTuple);
}}
string ITupleInternal.ToStringEnd()
{{
return "")"";
}}

public static ValueTuple<T1> Create<T1>(T1 item1)
{{
return new ValueTuple<T1>(item1);
}}
public static ValueTuple Create()
{{
return default(ValueTuple);
}}

public static (T1, T2) Create<T1, T2>(T1 item1, T2 item2)
{{
return (item1, item2);
}}
public static ValueTuple<T1> Create<T1>(T1 item1)
{{
return new ValueTuple<T1>(item1);
}}

public static (T1, T2, T3) Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3)
{{
return (item1, item2, item3);
}}
public static (T1, T2) Create<T1, T2>(T1 item1, T2 item2)
{{
return (item1, item2);
}}

public static (T1, T2, T3, T4) Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4)
{{
return (item1, item2, item3, item4);
}}
public static (T1, T2, T3) Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3)
{{
return (item1, item2, item3);
}}

public static (T1, T2, T3, T4, T5) Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5)
{{
return (item1, item2, item3, item4, item5);
}}
public static (T1, T2, T3, T4) Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4)
{{
return (item1, item2, item3, item4);
}}

public static (T1, T2, T3, T4, T5, T6) Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6)
{{
return (item1, item2, item3, item4, item5, item6);
}}
public static (T1, T2, T3, T4, T5) Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5)
{{
return (item1, item2, item3, item4, item5);
}}

public static (T1, T2, T3, T4, T5, T6, T7) Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7)
{{
return (item1, item2, item3, item4, item5, item6, item7);
}}
public static (T1, T2, T3, T4, T5, T6) Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6)
{{
return (item1, item2, item3, item4, item5, item6);
}}

public static (T1, T2, T3, T4, T5, T6, T7, T8) Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8)
{{
return new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8>>(item1, item2, item3, item4, item5, item6, item7, Create(item8));
}}
public static (T1, T2, T3, T4, T5, T6, T7) Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7)
{{
return (item1, item2, item3, item4, item5, item6, item7);
}}

internal static int CombineHashCodes(int h1, int h2)
{{
return ((h1 << 5) + h1) ^ h2;
}}
public static (T1, T2, T3, T4, T5, T6, T7, T8) Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8)
{{
return new ValueTuple<T1, T2, T3, T4, T5, T6, T7, ValueTuple<T8>>(item1, item2, item3, item4, item5, item6, item7, Create(item8));
}}

internal static int CombineHashCodes(int h1, int h2, int h3)
{{
return CombineHashCodes(CombineHashCodes(h1, h2), h3);
}}
internal static int CombineHashCodes(int h1, int h2)
{{
return ((h1 << 5) + h1) ^ h2;
}}

internal static int CombineHashCodes(int h1, int h2, int h3, int h4)
{{
return CombineHashCodes(CombineHashCodes(h1, h2), CombineHashCodes(h3, h4));
}}
internal static int CombineHashCodes(int h1, int h2, int h3)
{{
return CombineHashCodes(CombineHashCodes(h1, h2), h3);
}}

internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), h5);
}}
internal static int CombineHashCodes(int h1, int h2, int h3, int h4)
{{
return CombineHashCodes(CombineHashCodes(h1, h2), CombineHashCodes(h3, h4));
}}

internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), CombineHashCodes(h5, h6));
}}
internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), h5);
}}

internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), CombineHashCodes(h5, h6, h7));
}}
internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), CombineHashCodes(h5, h6));
}}

internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7, int h8)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), CombineHashCodes(h5, h6, h7, h8));
}}
internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), CombineHashCodes(h5, h6, h7));
}}

internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7, int h8)
{{
return CombineHashCodes(CombineHashCodes(h1, h2, h3, h4), CombineHashCodes(h5, h6, h7, h8));
}}
}}
#if false // {CSharpEditorResources.Decompilation_log}
Expand Down
Loading
Loading