Skip to content

Commit

Permalink
Merge pull request #33820 from dotnet/merges/master-to-features/reado…
Browse files Browse the repository at this point in the history
…nly-members

Merge master to features/readonly-members
  • Loading branch information
dotnet-automerge-bot authored Mar 2, 2019
2 parents d18f7ca + f424810 commit b5ec68d
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ public static void Main()

using (var workspace = TestWorkspace.CreateCSharp(source1))
{
var documentId = workspace.CurrentSolution.Projects.First().Documents.First().Id;
var oldProject = workspace.CurrentSolution.Projects.First();
var documentId = oldProject.Documents.First().Id;
var oldSolution = workspace.CurrentSolution;
var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));
var oldDocument = oldSolution.GetDocument(documentId);
Expand All @@ -276,7 +277,7 @@ public static void Main()
var oldStatementSyntax = oldSyntaxRoot.FindNode(oldStatementTextSpan);

var baseActiveStatements = ImmutableArray.Create(ActiveStatementsDescription.CreateActiveStatement(ActiveStatementFlags.IsLeafFrame, oldStatementSpan, DocumentId.CreateNewId(ProjectId.CreateNewId())));
var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newDocument, CancellationToken.None);
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newDocument, trackingServiceOpt: null, CancellationToken.None);

Assert.True(result.HasChanges);
Assert.True(result.SemanticEdits[0].PreserveLocalVariables);
Expand Down Expand Up @@ -316,12 +317,13 @@ public static void Main()

using (var workspace = TestWorkspace.CreateCSharp(source1))
{
var documentId = workspace.CurrentSolution.Projects.First().Documents.First().Id;
var oldProject = workspace.CurrentSolution.Projects.First();
var documentId = oldProject.Documents.First().Id;
var oldSolution = workspace.CurrentSolution;
var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));

var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newSolution.GetDocument(documentId), trackingServiceOpt: null, CancellationToken.None);

Assert.True(result.HasChanges);
Assert.True(result.HasChangesAndErrors);
Expand All @@ -345,9 +347,10 @@ public static void Main()

using (var workspace = TestWorkspace.CreateCSharp(source))
{
var document = workspace.CurrentSolution.Projects.First().Documents.First();
var oldProject = workspace.CurrentSolution.Projects.First();
var document = oldProject.Documents.First();
var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, document, trackingServiceOpt: null, CancellationToken.None);

Assert.False(result.HasChanges);
Assert.False(result.HasChangesAndErrors);
Expand Down Expand Up @@ -380,12 +383,13 @@ public static void Main()

using (var workspace = TestWorkspace.CreateCSharp(source1))
{
var documentId = workspace.CurrentSolution.Projects.First().Documents.First().Id;
var oldProject = workspace.CurrentSolution.Projects.First();
var documentId = oldProject.Documents.First().Id;
var oldSolution = workspace.CurrentSolution;
var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));

var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newSolution.GetDocument(documentId), trackingServiceOpt: null, CancellationToken.None);

Assert.False(result.HasChanges);
Assert.False(result.HasChangesAndErrors);
Expand All @@ -412,9 +416,10 @@ public static void Main()
using (var workspace = TestWorkspace.CreateCSharp(
source, parseOptions: experimental, compilationOptions: null, exportProvider: null))
{
var document = workspace.CurrentSolution.Projects.First().Documents.First();
var oldProject = workspace.CurrentSolution.Projects.First();
var document = oldProject.Documents.First();
var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, document, trackingServiceOpt: null, CancellationToken.None);

Assert.False(result.HasChanges);
Assert.False(result.HasChangesAndErrors);
Expand Down Expand Up @@ -457,12 +462,13 @@ public static void Main()
using (var workspace = TestWorkspace.CreateCSharp(
source1, parseOptions: experimental, compilationOptions: null, exportProvider: null))
{
var documentId = workspace.CurrentSolution.Projects.First().Documents.First().Id;
var oldProject = workspace.CurrentSolution.Projects.First();
var documentId = oldProject.Documents.First().Id;
var oldSolution = workspace.CurrentSolution;
var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));

var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newSolution.GetDocument(documentId), trackingServiceOpt: null, CancellationToken.None);

Assert.True(result.HasChanges);
Assert.True(result.HasChangesAndErrors);
Expand All @@ -489,9 +495,10 @@ public static void Main()

using (var workspace = TestWorkspace.CreateCSharp(source))
{
var document = workspace.CurrentSolution.Projects.First().Documents.First();
var oldProject = workspace.CurrentSolution.Projects.First();
var document = oldProject.Documents.First();
var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(workspace.CurrentSolution, baseActiveStatements, document, default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, document, trackingServiceOpt: null, CancellationToken.None);

Assert.False(result.HasChanges);
Assert.False(result.HasChangesAndErrors);
Expand Down Expand Up @@ -526,12 +533,13 @@ public static void Main()

using (var workspace = TestWorkspace.CreateCSharp(source1))
{
var documentId = workspace.CurrentSolution.Projects.First().Documents.First().Id;
var oldProject = workspace.CurrentSolution.Projects.First();
var documentId = oldProject.Documents.First().Id;
var oldSolution = workspace.CurrentSolution;
var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));

var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newSolution.GetDocument(documentId), trackingServiceOpt: null, CancellationToken.None);

Assert.True(result.HasChanges);

Expand Down Expand Up @@ -566,12 +574,13 @@ public static void Main(Bar x)

using (var workspace = TestWorkspace.CreateCSharp(source1))
{
var documentId = workspace.CurrentSolution.Projects.First().Documents.First().Id;
var oldProject = workspace.CurrentSolution.Projects.First();
var documentId = oldProject.Documents.First().Id;
var oldSolution = workspace.CurrentSolution;
var newSolution = workspace.CurrentSolution.WithDocumentText(documentId, SourceText.From(source2));

var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
var result = await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newSolution.GetDocument(documentId), default(CancellationToken));
var result = await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newSolution.GetDocument(documentId), trackingServiceOpt: null, CancellationToken.None);

Assert.True(result.HasChanges);
Assert.True(result.HasChangesAndErrors);
Expand Down Expand Up @@ -606,15 +615,15 @@ public class D
using (var workspace = TestWorkspace.CreateCSharp(source1))
{
// fork the solution to introduce a change
var project = workspace.CurrentSolution.Projects.Single();
var newDocId = DocumentId.CreateNewId(project.Id);
var oldProject = workspace.CurrentSolution.Projects.Single();
var newDocId = DocumentId.CreateNewId(oldProject.Id);
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.AddDocument(newDocId, "goo.cs", SourceText.From(source2));

workspace.TryApplyChanges(newSolution);

var newProject = newSolution.Projects.Single();
var changes = newProject.GetChanges(project);
var changes = newProject.GetChanges(oldProject);

Assert.Equal(2, newProject.Documents.Count());
Assert.Equal(0, changes.GetChangedDocuments().Count());
Expand All @@ -626,7 +635,7 @@ public class D
var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
foreach (var changedDocumentId in changedDocuments)
{
result.Add(await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newProject.GetDocument(changedDocumentId), default(CancellationToken)));
result.Add(await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newProject.GetDocument(changedDocumentId), trackingServiceOpt: null, CancellationToken.None));
}

Assert.True(result.IsSingle());
Expand Down Expand Up @@ -656,15 +665,15 @@ public static void Main()
using (var workspace = TestWorkspace.CreateCSharp(source1))
{
// fork the solution to introduce a change
var project = workspace.CurrentSolution.Projects.Single();
var newDocId = DocumentId.CreateNewId(project.Id);
var oldProject = workspace.CurrentSolution.Projects.Single();
var newDocId = DocumentId.CreateNewId(oldProject.Id);
var oldSolution = workspace.CurrentSolution;
var newSolution = oldSolution.AddDocument(newDocId, "goo.cs", SourceText.From(source2));

workspace.TryApplyChanges(newSolution);

var newProject = newSolution.Projects.Single();
var changes = newProject.GetChanges(project);
var changes = newProject.GetChanges(oldProject);

Assert.Equal(2, newProject.Documents.Count());
Assert.Equal(0, changes.GetChangedDocuments().Count());
Expand All @@ -676,7 +685,7 @@ public static void Main()
var baseActiveStatements = ImmutableArray.Create<ActiveStatement>();
foreach (var changedDocumentId in changedDocuments)
{
result.Add(await analyzer.AnalyzeDocumentAsync(oldSolution, baseActiveStatements, newProject.GetDocument(changedDocumentId), default(CancellationToken)));
result.Add(await analyzer.AnalyzeDocumentAsync(oldProject, baseActiveStatements, newProject.GetDocument(changedDocumentId), trackingServiceOpt: null, CancellationToken.None));
}

Assert.True(result.IsSingle());
Expand Down
Loading

0 comments on commit b5ec68d

Please sign in to comment.