Skip to content

Commit

Permalink
Merge pull request #13 from langsamu/master
Browse files Browse the repository at this point in the history
Typo in list init
  • Loading branch information
alecsg77 authored May 31, 2020
2 parents f263f80 + 6b907d7 commit 86f6700
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected virtual bool EqualsListInit([NotNull] ListInitExpression x, [NotNull]
{
return x.Type == y.Type
&& Equals(x.NewExpression, y.NewExpression)
&& Equals(x.Initializers, x.Initializers, EqualsElementInit);
&& Equals(x.Initializers, y.Initializers, EqualsElementInit);
}

/// <summary>Gets the hash code for the specified ListInitExpression.</summary>
Expand Down
10 changes: 10 additions & 0 deletions test/ExpressionTreeToolkit.UnitTests/Bugs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,15 @@ public void Issue_4()

AssertAreEqual(x, y);
}

[Fact]
public void Issue_12()
{
// Expressions similar to this code `new List<int> { 0|1 }`
var x = Expression.ListInit(Expression.New(typeof(List<int>)), Expression.Constant(0));
var y = Expression.ListInit(Expression.New(typeof(List<int>)), Expression.Constant(1));

AssertAreNotEqual(x, y);
}
}
}

0 comments on commit 86f6700

Please sign in to comment.