Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnC: Check member modifier updates in semantic analysis #54406

Merged
merged 4 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1867,7 +1867,7 @@ public C() {}
var active = GetActiveStatements(src1, src2);

edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.ModifiersUpdate, "const int a = 1", FeaturesResources.const_field));
Diagnostic(RudeEditKind.ModifiersUpdate, "a = 1", FeaturesResources.const_field));
tmat marked this conversation as resolved.
Show resolved Hide resolved
}

[Fact]
Expand Down Expand Up @@ -1917,7 +1917,7 @@ public C() {}
var active = GetActiveStatements(src1, src2);

edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.ModifiersUpdate, "const int a = 1, b = 2", FeaturesResources.const_field));
Diagnostic(RudeEditKind.ModifiersUpdate, "a = 1", FeaturesResources.const_field));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.CodeAnalysis.EditAndContinue;
using Microsoft.CodeAnalysis.EditAndContinue.UnitTests;
using Microsoft.CodeAnalysis.Text;
using Roslyn.Utilities;
tmat marked this conversation as resolved.
Show resolved Hide resolved
using Xunit;

namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Debugger.Contracts.EditAndContinue;
using Roslyn.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue.UnitTests
Expand All @@ -34,6 +35,17 @@ internal enum MethodKind
ConstructorWithParameters
}

public static string GetResource(string keyword)
=> keyword switch
{
"class" => FeaturesResources.class_,
"struct" => CSharpFeaturesResources.struct_,
"interface" => FeaturesResources.interface_,
"record" => CSharpFeaturesResources.record_,
"record struct" => CSharpFeaturesResources.record_struct,
_ => throw ExceptionUtilities.UnexpectedValue(keyword)
};

internal static SemanticEditDescription[] NoSemanticEdits = Array.Empty<SemanticEditDescription>();

internal static RudeEditDiagnosticDescription Diagnostic(RudeEditKind rudeEditKind, string squiggle, params string[] arguments)
Expand Down
Loading