Skip to content

Commit

Permalink
Merge pull request #51710 from dotnet/merges/main-to-main-vs-deps
Browse files Browse the repository at this point in the history
Merge main to main-vs-deps
  • Loading branch information
msftbot[bot] authored Mar 6, 2021
2 parents 7810437 + f2d3bd1 commit 9f95d53
Show file tree
Hide file tree
Showing 31 changed files with 990 additions and 239 deletions.
2 changes: 1 addition & 1 deletion src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9151,7 +9151,7 @@ public void ReportAnalyzerOutput()
Assert.Equal(0, exitCode);
var output = outWriter.ToString();
Assert.Contains(CodeAnalysisResources.AnalyzerExecutionTimeColumnHeader, output, StringComparison.Ordinal);
Assert.Contains(new WarningDiagnosticAnalyzer().ToString(), output, StringComparison.Ordinal);
Assert.Contains("WarningDiagnosticAnalyzer (Warning01)", output, StringComparison.Ordinal);
CleanupAllGeneratedFiles(srcFile.Path);
}

Expand Down
3 changes: 2 additions & 1 deletion src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,8 @@ private static void ReportAnalyzerExecutionTime(TextWriter consoleOutput, Analyz

analyzerTimeColumn = getFormattedTime(executionTime);
analyzerPercentageColumn = getFormattedPercentage(percentage);
analyzerNameColumn = getFormattedAnalyzerName(" " + kvp.Key.ToString());
var analyzerIds = string.Join(", ", kvp.Key.SupportedDiagnostics.Select(d => d.Id).Distinct().OrderBy(id => id));
analyzerNameColumn = getFormattedAnalyzerName($" {kvp.Key} ({analyzerIds})");

consoleOutput.WriteLine(analyzerTimeColumn + analyzerPercentageColumn + analyzerNameColumn);
}
Expand Down
31 changes: 31 additions & 0 deletions src/EditorFeatures/CSharpTest/CodeLens/CSharpCodeLensTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,36 @@ private void Test()
</Workspace>";
await RunReferenceTest(input);
}

[Fact, Trait(Traits.Feature, Traits.Features.CodeLens)]
[WorkItem(51633, "https://github.com/dotnet/roslyn/issues/51633")]
public async Task TestMethodRefSourceGeneratedDocument()
{
const string input = @"<Workspace>
<Project Language=""C#"" CommonReferences=""true"" AssemblyName=""Proj1"">
<Document FilePath=""Program.cs""><![CDATA[
namespace ConsoleSample
{
class Program
{
{|1:public Program()
{
}|}
}
}]]>
</Document>
<DocumentFromSourceGenerator><![CDATA[
namespace ConsoleSample
{
internal partial class Program
{
public static CreateProgram() => new Program();
}
}]]>
</DocumentFromSourceGenerator>
</Project>
</Workspace>";
await RunMethodReferenceTest(input);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static async Task FindSymbolReferencesAsync(
await context.SetSearchTitleAsync(string.Format(EditorFeaturesResources._0_references,
FindUsagesHelpers.GetDisplayName(symbol))).ConfigureAwait(false);

var options = FindSymbols.FindReferencesSearchOptions.GetFeatureOptionsForStartingSymbol(symbol);
var options = FindReferencesSearchOptions.GetFeatureOptionsForStartingSymbol(symbol);

// Now call into the underlying FAR engine to find reference. The FAR
// engine will push results into the 'progress' instance passed into it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,57 @@ class Usages
End Function

<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpAccessor_FromNameOf_Feature1(host As TestHost) As Task
Public Async Function TestCSharpAccessor_FromNameOf1_Api(host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document>
interface IC
{
int {|Definition:Prop|} { get; set; }
}

class C : IC
{
public virtual int {|Definition:Prop|} { get; set; }
}

class D : C
{
public override int {|Definition:Prop|} { get => base.[|Prop|]; set => base.[|Prop|] = value; }
}

class Usages
{
void M()
{
IC ic;
var n1 = nameof(ic.[|$$Prop|]);
var v1 = ic.[|Prop|];
ic.[|Prop|] = 1;
ic.[|Prop|]++;

C c;
var n2 = nameof(c.[|Prop|]);
var v2 = c.[|Prop|];
c.[|Prop|] = 1;
c.[|Prop|]++;

D d;
var n3 = nameof(d.[|Prop|]);
var v3 = d.[|Prop|];
d.[|Prop|] = 1;
d.[|Prop|]++;
}
}
</Document>
</Project>
</Workspace>
Await TestAPI(input, host)
End Function

<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCSharpAccessor_FromNameOf1_Feature(host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class C : I<int>, I<string>

<WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCascadedMembersFromConstructedInterfaces5(kind As TestKind, host As TestHost) As Task
Public Async Function TestCascadedMembersFromConstructedInterfaces5_Api(host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
Expand All @@ -564,12 +564,36 @@ class C : I<int>, I<string>
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
Await TestAPI(input, host)
End Function

<WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCascadedMembersFromConstructedInterfaces5_FEature(host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
interface I<X>
{
void {|Definition:Goo|}(X x);
}

class C : I<int>, I<string>
{
public void {|Definition:$$Goo|}(int x) { }
public void Goo(string x) { }
}
]]>
</Document>
</Project>
</Workspace>
Await TestStreamingFeature(input, host)
End Function

<WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCascadedMembersFromConstructedInterfaces6(kind As TestKind, host As TestHost) As Task
Public Async Function TestCascadedMembersFromConstructedInterfaces6_Api(host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
Expand All @@ -588,7 +612,31 @@ class C : I<int>, I<string>
</Document>
</Project>
</Workspace>
Await TestAPIAndFeature(input, kind, host)
Await TestAPI(input, host)
End Function

<WorkItem(539883, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539883")>
<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Public Async Function TestCascadedMembersFromConstructedInterfaces6_Feature(host As TestHost) As Task
Dim input =
<Workspace>
<Project Language="C#" CommonReferences="true">
<Document><![CDATA[
interface I<X>
{
void {|Definition:Goo|}(X x);
}

class C : I<int>, I<string>
{
public void Goo(int x) { }
public void {|Definition:$$Goo|}(string x) { }
}
]]>
</Document>
</Project>
</Workspace>
Await TestStreamingFeature(input, host)
End Function

<WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.FindReferences)>
Expand Down
Loading

0 comments on commit 9f95d53

Please sign in to comment.