提交 cf3206d2 编写于 作者: N Nat Ayewah 提交者: GitHub

Merge pull request #21715 from dotnet/merges/dev15.4.x-to-master-20170824-070011

Merge dev15.4.x to master
......@@ -139,7 +139,7 @@
<RestSharpVersion>105.2.3</RestSharpVersion>
<RoslynBuildUtilVersion>0.9.8-beta</RoslynBuildUtilVersion>
<RoslynDependenciesMicrosoftVisualStudioWorkspaceVersion>14.0.983-pre-ge167e81694</RoslynDependenciesMicrosoftVisualStudioWorkspaceVersion>
<RoslynDependenciesOptimizationDataVersion>2.3.0-beta3-61801-06</RoslynDependenciesOptimizationDataVersion>
<RoslynDependenciesOptimizationDataVersion>2.6.0-beta1-62010-04</RoslynDependenciesOptimizationDataVersion>
<RoslynToolsMicrosoftLocateVSVersion>0.2.4-beta</RoslynToolsMicrosoftLocateVSVersion>
<RoslynToolsMicrosoftSignToolVersion>0.3.0-beta</RoslynToolsMicrosoftSignToolVersion>
<RoslynToolsMicrosoftVSIXExpInstallerVersion>0.4.0-beta</RoslynToolsMicrosoftVSIXExpInstallerVersion>
......
......@@ -7703,6 +7703,34 @@ static void Main()
CompileAndVerify(comp, expectedOutput: "once");
}
[WorkItem(21028, "https://github.com/dotnet/roslyn/issues/21028")]
[Fact]
public void InferredName()
{
var source =
@"class C
{
static void Main()
{
int x = 0, y = 1;
var t = (x, y);
var (a, b) = t;
}
}";
// C# 7.0
var comp = CreateStandardCompilation(
source,
parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7),
references: new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyEmitDiagnostics();
// C# 7.1
comp = CreateStandardCompilation(
source,
parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp7_1),
references: new[] { ValueTupleRef, SystemRuntimeFacadeRef });
comp.VerifyEmitDiagnostics();
}
[WorkItem(21028, "https://github.com/dotnet/roslyn/issues/21028")]
[Fact]
public void InferredName_ConditionalOperator()
......
......@@ -418,26 +418,29 @@ public void Done()
public bool SupportedDiagnosticId(ProjectId projectId, string id)
{
if (_diagnosticIdMap.TryGetValue(projectId, out var ids))
lock (_diagnosticIdMap)
{
return ids.Contains(id);
}
if (_diagnosticIdMap.TryGetValue(projectId, out var ids))
{
return ids.Contains(id);
}
// set ids set
var map = new HashSet<string>();
_diagnosticIdMap.Add(projectId, map);
// set ids set
var map = new HashSet<string>();
_diagnosticIdMap.Add(projectId, map);
var project = _solution.GetProject(projectId);
if (project == null)
{
// projectId no longer exist, return false;
return false;
}
var project = _solution.GetProject(projectId);
if (project == null)
{
// projectId no longer exist, return false;
return false;
}
var descriptorMap = _owner._diagnosticService.GetDiagnosticDescriptors(project);
map.UnionWith(descriptorMap.Values.SelectMany(v => v.Select(d => d.Id)));
var descriptorMap = _owner._diagnosticService.GetDiagnosticDescriptors(project);
map.UnionWith(descriptorMap.Values.SelectMany(v => v.Select(d => d.Id)));
return map.Contains(id);
return map.Contains(id);
}
}
public ImmutableArray<DiagnosticData> GetBuildDiagnostics()
......
......@@ -68,6 +68,20 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
End Using
End Sub
<Fact>
Public Sub TestExternalDiagnostics_SupportedDiagnosticId_Concurrent()
Using workspace = TestWorkspace.CreateCSharp(String.Empty)
Dim waiter = New Waiter()
Dim service = New TestDiagnosticAnalyzerService()
Dim source = New ExternalErrorDiagnosticUpdateSource(workspace, service, New MockDiagnosticUpdateSourceRegistrationService(), waiter)
Dim project = workspace.CurrentSolution.Projects.First()
source.OnSolutionBuild(Me, Shell.UIContextChangedEventArgs.From(True))
Parallel.For(0, 100, Sub(i As Integer) source.SupportedDiagnosticId(project.Id, "CS1002"))
End Using
End Sub
<Fact>
Public Async Function TestExternalDiagnostics_DuplicatedError() As Task
Using workspace = TestWorkspace.CreateCSharp(String.Empty)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册