diff --git a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs index c76c4a81c..fac324650 100644 --- a/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs +++ b/ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs @@ -2850,7 +2850,7 @@ public override object Visit (ArrayCreation arrayCreationExpression) next = next.Next; } - if (arrayCreationExpression.Initializers != null && arrayCreationExpression.Initializers.Count != 0) { + if (arrayCreationExpression.Initializers != null) { var initLocation = LocationsBag.GetLocations (arrayCreationExpression.Initializers); ArrayInitializerExpression initializer = new ArrayInitializerExpression (); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs index 78af8938d..16077caff 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/Parser/Expression/ArrayCreateExpressionTests.cs @@ -146,7 +146,18 @@ public void AssignmentInArrayInitializer() } }}); } - + + [Test] + public void EmptyArrayCreation() + { + var ace = ParseUtilCSharp.ParseExpression("new [] { }"); + Assert.AreEqual(new Role[] { + Roles.LBrace, + Roles.RBrace + }, ace.Initializer.Children.Select(c => c.Role).ToArray()); + } + + [Test, Ignore("Parser bug")] public void ArrayInitializerWithCommaAtEnd() {