提交 41a4f69d 编写于 作者: A Andrew Casey

Merge pull request #4784 from amcasey/DiagArgEquals

Use object.Equals when comparing diag arguments
......@@ -2042,6 +2042,25 @@ public static int Main()
Assert.Equal(1, compilation.GetDiagnostics().Length);
}
[Fact]
public void TestArgumentEquality()
{
var text = @"
using System;
public class Test
{
public static void Main()
{
(Console).WriteLine();
}
}";
var tree = Parse(text);
// (8,10): error CS0119: 'Console' is a type, which is not valid in the given context
AssertEx.Equal(CreateCompilationWithMscorlib(tree).GetDiagnostics(), CreateCompilationWithMscorlib(tree).GetDiagnostics());
}
#region Mocks
internal class CustomErrorInfo : DiagnosticInfo
{
......
......@@ -437,7 +437,7 @@ public override bool Equals(object obj)
result = true;
for (int i = 0; i < _arguments.Length; i++)
{
if (_arguments[i] != other._arguments[i])
if (!object.Equals(_arguments[i], other._arguments[i]))
{
result = false;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册