forked from dotnet/roslyn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Possible approach for fixing dotnet#16195
- Loading branch information
Showing
4 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using Microsoft.CodeAnalysis.Test.Utilities; | ||
using Roslyn.Test.Utilities; | ||
using Xunit; | ||
|
||
namespace Microsoft.CodeAnalysis.CSharp.UnitTests.Semantics | ||
{ | ||
public class FuzzTests : CompilingTestBase | ||
{ | ||
[Fact, WorkItem(16167, "https://github.com/dotnet/roslyn/issues/16167")] | ||
public void CompileXmlAsSource() | ||
{ | ||
var text = @" | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
class C | ||
{ | ||
public static void Main() | ||
{ | ||
<summary>Copies a range of elements from an <see cref=""T:System.Array"" /> starting at the first element and pastes them into another <see cref=""T:System.Array"" /> starting at the first element. The length is specified as a 32-bit integer.</summary> | ||
<param name=""sourceArray"">The <see cref=""T:System.Array"" /> that contains the data to copy.</param> | ||
<param name=""destinationArray"">The <see cref=""T:System.Array"" /> that receives the data.</param> | ||
<param name=""length"">A 32-bit integer that represents the number of elements to copy.</param> | ||
<exception cref=""T:System.ArgumentNullException""> | ||
<paramref name=""sourceArray"" /> is null.-or-<paramref name=""destinationArray"" /> is null.</exception> | ||
<exception cref=""T:System.RankException""> | ||
<paramref name=""sourceArray"" /> and <paramref name=""destinationArray"" /> have different ranks.</exception> | ||
<exception cref=""T:System.ArrayTypeMismatchException""> | ||
<paramref name=""sourceArray"" /> and <paramref name=""destinationArray"" /> are of incompatible types.</exception> | ||
<exception cref=""T:System.InvalidCastException"">At least one element in <paramref name=""sourceArray"" /> cannot be cast to the type of <paramref name=""destinationArray"" />.</exception> | ||
<exception cref=""T:System.ArgumentOutOfRangeException""> | ||
<paramref name=""length"" /> is less than zero.</exception> | ||
<exception cref=""T:System.ArgumentException""> | ||
<paramref name=""length"" /> is greater than the number of elements in <paramref name=""sourceArray"" />.-or-<paramref name=""length"" /> is greater than the number of elements in <paramref name=""destinationArray"" />.</exception> | ||
} | ||
} | ||
"; | ||
var compilation = CreateCompilationWithMscorlib45(text); | ||
var tree = compilation.SyntaxTrees[0]; | ||
var model = compilation.GetSemanticModel(tree); | ||
foreach (var node in tree.GetRoot().DescendantNodes()) | ||
{ | ||
var _ = model.GetSymbolInfo(node); | ||
} | ||
} | ||
|
||
[Fact, WorkItem(16167, "https://github.com/dotnet/roslyn/issues/16167")] | ||
public void Bug16167Root() | ||
{ | ||
var text = @" | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
class C | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
void Local1(bool b = args is string[] z1) {} | ||
void Local2(bool b = M(out int z2)) {} | ||
void Local3((int, int) ii = ((int a1, int a2) = (1, 2)) {} | ||
} | ||
} | ||
"; | ||
var compilation = CreateCompilationWithMscorlib45(text); | ||
var tree = compilation.SyntaxTrees[0]; | ||
var model = compilation.GetSemanticModel(tree); | ||
foreach (var node in tree.GetRoot().DescendantNodes()) | ||
{ | ||
var _ = model.GetSymbolInfo(node); | ||
} | ||
} | ||
} | ||
} |