提交 5edcfa9d 编写于 作者: T Tomas Matousek

Enable editing methods with anonymous types and remove unused rude edit kinds

上级 6577b5c9
......@@ -495,7 +495,7 @@ class C
var active = GetActiveStatements(src1, src2);
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "get"));
Diagnostic(RudeEditKind.DeleteActiveStatement, "get"));
}
[Fact]
......@@ -545,7 +545,7 @@ class C
var active = GetActiveStatements(src1, src2);
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "=> M()"));
Diagnostic(RudeEditKind.DeleteActiveStatement, "=> M()"));
}
#endregion
......@@ -903,7 +903,7 @@ class SampleCollection<T>
var active = GetActiveStatements(src1, src2);
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "{"));
Diagnostic(RudeEditKind.DeleteActiveStatement, "{"));
}
[Fact]
......@@ -1002,7 +1002,7 @@ class SampleCollection<T>
var active = GetActiveStatements(src1, src2);
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "{"));
Diagnostic(RudeEditKind.DeleteActiveStatement, "{"));
}
#endregion
......
......@@ -638,7 +638,7 @@ public static void Main()
Assert.True(result.IsSingle());
Assert.Equal(1, result.Single().RudeEditErrors.Count());
Assert.Equal(RudeEditKind.RUDE_EDIT_ADD_NEW_FILE, result.Single().RudeEditErrors.Single().Kind);
Assert.Equal(RudeEditKind.InsertFile, result.Single().RudeEditErrors.Single().Kind);
}
}
}
......
......@@ -3083,22 +3083,18 @@ public void MethodUpdate_AnonymousType()
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "method"));
edits.VerifyRudeDiagnostics();
}
[Fact]
public void MethodWithExpressionBody_Update_AnonymousType()
{
var src1 = "class C { void M() => new { A = 1, B = 2 }; }";
var src2 = "class C { void M() => new { A = 10, B = 20 }; }";
var src1 = "class C { void M() => F(new { A = 1, B = 2 }); }";
var src2 = "class C { void M() => F(new { A = 10, B = 20 }); }";
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "method"));
edits.VerifyRudeDiagnostics();
}
[Fact]
......@@ -3543,7 +3539,7 @@ class B
Diagnostic(RudeEditKind.Delete, "class B", "destructor"));
}
[Fact(Skip = "789577")]
[Fact]
[WorkItem(789577)]
public void ConstructorUpdate_AnonymousTypeInFieldInitializer()
{
......@@ -3552,9 +3548,7 @@ public void ConstructorUpdate_AnonymousTypeInFieldInitializer()
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "constructor"));
edits.VerifyRudeDiagnostics();
}
[Fact]
......@@ -4529,9 +4523,7 @@ public void FieldInitializerUpdate_AnonymousTypeInConstructor()
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifySemanticDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "constructor"));
edits.VerifySemanticDiagnostics();
}
[Fact]
......@@ -4542,9 +4534,7 @@ public void PropertyInitializerUpdate_AnonymousTypeInConstructor()
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifySemanticDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "constructor"));
edits.VerifySemanticDiagnostics();
}
[Fact]
......@@ -4687,9 +4677,7 @@ public void FieldInitializerUpdate_AnonymousType()
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "field"));
edits.VerifyRudeDiagnostics();
}
[Fact]
......@@ -4700,9 +4688,7 @@ public void PropertyInitializerUpdate_AnonymousType()
var edits = GetTopEdits(src1, src2);
// TODO (tomat): no errors
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "auto-property"));
edits.VerifyRudeDiagnostics();
}
#endregion
......
......@@ -22,18 +22,10 @@ public void ToDiagnostic()
var arg0 = new HashSet<RudeEditKind>()
{
RudeEditKind.ActiveStatementUpdate,
RudeEditKind.STMT_MID_DELETE,
RudeEditKind.STMT_NON_LEAF_DELETE,
RudeEditKind.STMT_CTOR_CALL,
RudeEditKind.STMT_FIELD_INIT,
RudeEditKind.STMT_DELETE,
RudeEditKind.STMT_DELETE_REMAP,
RudeEditKind.STMT_READONLY,
RudeEditKind.RUDE_NO_ACTIVE_STMT,
RudeEditKind.RUDE_ACTIVE_STMT_DELETED,
RudeEditKind.EXC_HANDLER_ERROR,
RudeEditKind.EXC_FINALLY_ERROR,
RudeEditKind.EXC_CATCH_ERROR,
RudeEditKind.DeleteActiveStatement,
RudeEditKind.UpdateExceptionHandlerOfActiveTry,
RudeEditKind.UpdateTryOrCatchWithActiveFinally,
RudeEditKind.UpdateCatchHandlerAroundActiveStatement,
RudeEditKind.FieldKindUpdate,
RudeEditKind.TypeKindUpdate,
RudeEditKind.AccessorKindUpdate,
......@@ -48,23 +40,7 @@ public void ToDiagnostic()
RudeEditKind.GenericTypeUpdate,
RudeEditKind.ExperimentalFeaturesEnabled,
RudeEditKind.AwaitStatementUpdate,
RudeEditKind.RUDE_EDIT_MODIFY_ANON_METHOD,
RudeEditKind.RUDE_EDIT_ADD_ANON_METHOD,
RudeEditKind.RUDE_EDIT_DELETE_ANON_METHOD,
RudeEditKind.RUDE_EDIT_MOVE_ANON_METHOD,
RudeEditKind.RUDE_EDIT_MODIFY_LAMBDA_EXPRESSION,
RudeEditKind.RUDE_EDIT_ADD_LAMBDA_EXPRESSION,
RudeEditKind.RUDE_EDIT_DELETE_LAMBDA_EXPRESSION,
RudeEditKind.RUDE_EDIT_MOVE_LAMBDA_EXPRESSION,
RudeEditKind.RUDE_EDIT_MODIFY_QUERY_EXPRESSION,
RudeEditKind.RUDE_EDIT_ADD_QUERY_EXPRESSION,
RudeEditKind.RUDE_EDIT_DELETE_QUERY_EXPRESSION,
RudeEditKind.RUDE_EDIT_MOVE_QUERY_EXPRESSION,
RudeEditKind.RUDE_EDIT_MODIFY_ANONYMOUS_TYPE,
RudeEditKind.RUDE_EDIT_ADD_ANONYMOUS_TYPE,
RudeEditKind.RUDE_EDIT_DELETE_ANONYMOUS_TYPE,
RudeEditKind.RUDE_EDIT_MOVE_ANONYMOUS_TYPE,
RudeEditKind.RUDE_EDIT_ADD_NEW_FILE,
RudeEditKind.InsertFile,
};
var arg2 = new HashSet<RudeEditKind>()
......
......@@ -313,7 +313,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Shared Sub Main()"))
Diagnostic(RudeEditKind.DeleteActiveStatement, "Shared Sub Main()"))
End Sub
<Fact, WorkItem(755959)>
......@@ -418,21 +418,21 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Do"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "If True"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Else"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Case 1, 2"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Case Else"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "While True"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Do Until True"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "If True Then"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Else"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "For i = 0 To 10"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "For Each i In {1, 2}"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Using z = New C()"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "With expr"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Shared Sub Main()"),
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "SyncLock Nothing"))
Diagnostic(RudeEditKind.DeleteActiveStatement, "Do"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "If True"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Else"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Case 1, 2"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Case Else"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "While True"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Do Until True"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "If True Then"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Else"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "For i = 0 To 10"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "For Each i In {1, 2}"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Using z = New C()"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "With expr"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "Shared Sub Main()"),
Diagnostic(RudeEditKind.DeleteActiveStatement, "SyncLock Nothing"))
End Sub
<Fact>
......@@ -473,7 +473,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "If c1 Then"))
Diagnostic(RudeEditKind.DeleteActiveStatement, "If c1 Then"))
End Sub
<Fact>
......@@ -510,7 +510,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "If c1 Then"))
Diagnostic(RudeEditKind.DeleteActiveStatement, "If c1 Then"))
End Sub
<Fact, WorkItem(755959)>
......@@ -645,7 +645,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, "Sub Main()"))
Diagnostic(RudeEditKind.DeleteActiveStatement, "Sub Main()"))
End Sub
<Fact, WorkItem(755959)>
......@@ -2423,7 +2423,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "SyncLock lockThis", "SyncLock block"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "SyncLock lockThis", "SyncLock block"))
End Sub
<Fact>
......@@ -2459,8 +2459,8 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "SyncLock d", "SyncLock block"),
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "SyncLock e", "SyncLock block"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "SyncLock d", "SyncLock block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "SyncLock e", "SyncLock block"))
End Sub
<Fact>
......@@ -2496,7 +2496,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "SyncLock d", "SyncLock statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "SyncLock d", "SyncLock statement"))
End Sub
<WorkItem(755752)>
......@@ -2523,7 +2523,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "SyncLock ""test""", "SyncLock statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "SyncLock ""test""", "SyncLock statement"))
End Sub
<Fact>
......@@ -2674,9 +2674,9 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "For Each b In e1", "For Each block"),
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "For Each c In e1", "For Each block"),
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "For Each a In e1", "For Each block"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "For Each b In e1", "For Each block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "For Each c In e1", "For Each block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "For Each a In e1", "For Each block"))
End Sub
<Fact>
......@@ -2809,8 +2809,8 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "For Each a In e1", "For Each block"),
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "For Each b In e1", "For Each block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "For Each a In e1", "For Each block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "For Each b In e1", "For Each block"),
Diagnostic(RudeEditKind.RUDE_EDIT_LAMBDA_EXPRESSION, "Sub()", "method"))
End Sub
......@@ -2846,7 +2846,7 @@ End Class
"
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Using c", "Using block"))
edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Using c", "Using block"))
End Sub
<Fact>
......@@ -2887,7 +2887,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Using c", "Using block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Using c", "Using block"),
Diagnostic(RudeEditKind.RUDE_EDIT_LAMBDA_EXPRESSION, "Function()", "method"))
End Sub
......@@ -2924,7 +2924,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "With c", "With block"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "With c", "With block"))
End Sub
<Fact>
......@@ -2965,7 +2965,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "With c", "With block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "With c", "With block"),
Diagnostic(RudeEditKind.RUDE_EDIT_LAMBDA_EXPRESSION, "Function()", "method"))
End Sub
......@@ -3005,7 +3005,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Try", "Try block"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Try", "Try block"))
End Sub
<Fact>
......@@ -3071,7 +3071,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Foo()", "Try block"))
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Foo()", "Try block"))
End Sub
<Fact>
......@@ -3141,7 +3141,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Try", "Try block"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Try", "Try block"))
End Sub
<Fact>
......@@ -3281,7 +3281,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3316,7 +3316,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3351,7 +3351,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Foo()", "Catch clause"))
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Foo()", "Catch clause"))
End Sub
<Fact>
......@@ -3384,7 +3384,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Console.WriteLine(1)", "Catch clause"))
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Console.WriteLine(1)", "Catch clause"))
End Sub
<Fact>
......@@ -3421,7 +3421,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3458,7 +3458,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3496,7 +3496,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.ActiveStatementUpdate, "Catch e As IOException When Foo(2)"),
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3533,7 +3533,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3571,7 +3571,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Catch", "Catch clause"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Catch", "Catch clause"))
End Sub
<Fact>
......@@ -3605,7 +3605,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Finally", "Finally clause"))
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Finally", "Finally clause"))
End Sub
<Fact>
......@@ -3638,7 +3638,7 @@ End Class
"
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Finally", "Finally clause"))
edits.VerifyRudeDiagnostics(active, Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Finally", "Finally clause"))
End Sub
<Fact>
......@@ -3672,7 +3672,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Foo()", "Finally clause"))
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Foo()", "Finally clause"))
End Sub
<Fact>
......@@ -3707,7 +3707,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Console.WriteLine(1)", "Finally clause"))
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Console.WriteLine(1)", "Finally clause"))
End Sub
<Fact>
......@@ -3761,10 +3761,10 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Catch", "Catch clause"),
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Try", "Try block"),
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Foo()", "Try block"),
Diagnostic(RudeEditKind.RUDE_EDIT_INSERT_AROUND, "Finally", "Finally clause"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Catch", "Catch clause"),
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Try", "Try block"),
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Foo()", "Try block"),
Diagnostic(RudeEditKind.InsertAroundActiveStatement, "Finally", "Finally clause"))
End Sub
<Fact>
......@@ -3887,7 +3887,7 @@ End Class
Dim edits = GetTopEdits(src1, src2)
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_DELETE_AROUND, "Return 1 + Foo(x)", "Try block"),
Diagnostic(RudeEditKind.DeleteAroundActiveStatement, "Return 1 + Foo(x)", "Try block"),
Diagnostic(RudeEditKind.RUDE_EDIT_LAMBDA_EXPRESSION, "Function(x)", "method"))
End Sub
......@@ -4424,7 +4424,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "On Error GoTo label", "On Error statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "On Error GoTo label", "On Error statement"))
End Sub
<Fact>
......@@ -4435,7 +4435,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "On Error GoTo 0", "On Error statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "On Error GoTo 0", "On Error statement"))
End Sub
<Fact>
......@@ -4446,7 +4446,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "On Error GoTo -1", "On Error statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "On Error GoTo -1", "On Error statement"))
End Sub
<Fact>
......@@ -4457,7 +4457,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "On Error Resume Next", "On Error statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "On Error Resume Next", "On Error statement"))
End Sub
<Fact>
......@@ -4468,7 +4468,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Resume", "Resume statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Resume", "Resume statement"))
End Sub
<Fact>
......@@ -4479,7 +4479,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Resume Next", "Resume statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Resume Next", "Resume statement"))
End Sub
<Fact>
......@@ -4490,7 +4490,7 @@ End Class
Dim active = GetActiveStatements(src1, src2)
edits.VerifyRudeDiagnostics(active,
Diagnostic(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, "Resume label", "Resume statement"))
Diagnostic(RudeEditKind.UpdateAroundActiveStatement, "Resume label", "Resume statement"))
End Sub
#End Region
......
......@@ -2366,8 +2366,7 @@ End Class
Dim src2 = "Class C" & vbLf & "Sub M()" & vbLf & "F(2, New With { .A = 1, .B = 2 }) : End Sub : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "New With", "method"))
edits.VerifyRudeDiagnostics()
End Sub
<Fact>
......@@ -2411,7 +2410,7 @@ End Class
"Insert [()]@44")
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ADD_HANDLES_CLAUSE, "Private Sub Foo()", "method"))
Diagnostic(RudeEditKind.InsertHandlesClause, "Private Sub Foo()", "method"))
End Sub
#End Region
......@@ -2469,14 +2468,13 @@ End Class
Diagnostic(RudeEditKind.Insert, "b As Integer", "parameter"))
End Sub
<Fact(Skip:="789577"), WorkItem(789577)>
<Fact, WorkItem(789577)>
Public Sub ConstructorUpdate_AnonymousTypeInFieldInitializer()
Dim src1 = "Class C : Dim a As Integer = F(New With { .A = 1, .B = 2 })" & vbLf & "Sub New()" & vbLf & " x = 1 : End Sub : End Class"
Dim src2 = "Class C : Dim a As Integer = F(New With { .A = 1, .B = 2 })" & vbLf & "Sub New()" & vbLf & " x = 2 : End Sub : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "constructor"))
edits.VerifyRudeDiagnostics()
End Sub
<Fact>
......@@ -4381,24 +4379,22 @@ End Class
Diagnostic(RudeEditKind.RUDE_EDIT_QUERY_EXPRESSION, "From", "constructor"))
End Sub
<Fact(Skip:="726990")>
<Fact>
Public Sub FieldUpdate_AnonymousTypeInConstructor()
Dim src1 = "Class C : Dim a As Integer = 1 : " & vbLf & "Sub New()" & vbLf & "F(New With { .A = 1, .B = 2 }) : End Sub : End Class"
Dim src2 = "Class C : Dim a As Integer = 2 : " & vbLf & "Sub New()" & vbLf & "F(New With { .A = 1, .B = 2 }) : End Sub : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifySemanticDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "new", "constructor"))
edits.VerifySemanticDiagnostics()
End Sub
<Fact(Skip:="726990")>
<Fact>
Public Sub PropertyUpdate_AnonymousTypeInConstructor()
Dim src1 = "Class C : Property a As Integer = 1 : " & vbLf & "Sub New()" & vbLf & "F(New With { .A = 1, .B = 2 }) : End Sub : End Class"
Dim src2 = "Class C : Property a As Integer = 2 : " & vbLf & "Sub New()" & vbLf & "F(New With { .A = 1, .B = 2 }) : End Sub : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifySemanticDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "New With", "constructor"))
edits.VerifySemanticDiagnostics()
End Sub
<Fact>
......@@ -4687,8 +4683,7 @@ End Class
Dim src2 = "Class C : Dim a As Integer = F(2, New With { .A = 1, .B = 2 }) : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "New With", "field"))
edits.VerifyRudeDiagnostics()
End Sub
<Fact>
......@@ -4697,8 +4692,7 @@ End Class
Dim src2 = "Class C : Property a As Integer = F(2, New With { .A = 1, .B = 2 }) : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "New With", "auto-property"))
edits.VerifyRudeDiagnostics()
End Sub
<Fact>
......@@ -4707,8 +4701,7 @@ End Class
Dim src2 = "Class C : Property a As New C(2, New With { .A = 1, .B = 2 }) : End Class"
Dim edits = GetTopEdits(src1, src2)
edits.VerifyRudeDiagnostics(
Diagnostic(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, "New With", "auto-property"))
edits.VerifyRudeDiagnostics()
End Sub
#End Region
......
......@@ -640,7 +640,7 @@ End Class
Assert.True(result.IsSingle())
Assert.Equal(1, result.Single().RudeEditErrors.Count())
Assert.Equal(RudeEditKind.RUDE_EDIT_ADD_NEW_FILE, result.Single().RudeEditErrors.Single().Kind)
Assert.Equal(RudeEditKind.InsertFile, result.Single().RudeEditErrors.Single().Kind)
End Using
End Sub
End Class
......
......@@ -2511,11 +2511,6 @@ public void ClassifyDeclarationBodyRudeUpdates(SyntaxNode newDeclarationOrBody,
ReportError(RudeEditKind.RUDE_EDIT_QUERY_EXPRESSION, node, _newNode);
}
return;
case SyntaxKind.AnonymousObjectCreationExpression:
// TODO (tomat): allow
ReportError(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, node, _newNode);
return;
}
}
}
......
......@@ -416,7 +416,7 @@ private bool HasInitializer(SyntaxNode declaration)
{
DocumentAnalysisResults.Log.Write("A new file added: {0}", document.Name);
return DocumentAnalysisResults.SyntaxErrors(ImmutableArray.Create(
new RudeEditDiagnostic(RudeEditKind.RUDE_EDIT_ADD_NEW_FILE, default(TextSpan))));
new RudeEditDiagnostic(RudeEditKind.InsertFile, default(TextSpan))));
}
cancellationToken.ThrowIfCancellationRequested();
......@@ -1073,7 +1073,7 @@ internal struct UpdatedMethodInfo
{
// rude edit: internal active statement deleted
diagnostics.Add(
new RudeEditDiagnostic(RudeEditKind.RUDE_ACTIVE_STMT_DELETED,
new RudeEditDiagnostic(RudeEditKind.DeleteActiveStatement,
GetDeletedNodeDiagnosticSpan(match.Matches, oldStatementSyntax)));
}
}
......@@ -1275,7 +1275,7 @@ internal struct UpdatedMethodInfo
var insertedNode = newStateMachineSuspensionPoints[rudeEdit.NewIndex];
diagnostics.Add(new RudeEditDiagnostic(
creatingStateMachineAroundActiveStatement ? RudeEditKind.RUDE_EDIT_INSERT_AROUND : RudeEditKind.Insert,
creatingStateMachineAroundActiveStatement ? RudeEditKind.InsertAroundActiveStatement : RudeEditKind.Insert,
GetDiagnosticSpan(insertedNode, EditKind.Insert),
insertedNode,
new[] { GetStatementDisplayName(insertedNode, EditKind.Insert) }));
......@@ -1588,7 +1588,7 @@ protected void AddRudeDiagnostic(List<RudeEditDiagnostic> diagnostics, SyntaxNod
protected void AddRudeUpdateAroundActiveStatement(List<RudeEditDiagnostic> diagnostics, SyntaxNode newNode)
{
diagnostics.Add(new RudeEditDiagnostic(
RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT,
RudeEditKind.UpdateAroundActiveStatement,
GetDiagnosticSpan(newNode, EditKind.Update),
newNode,
new[] { GetStatementDisplayName(newNode, EditKind.Update) }));
......@@ -1597,7 +1597,7 @@ protected void AddRudeUpdateAroundActiveStatement(List<RudeEditDiagnostic> diagn
protected void AddRudeInsertAroundActiveStatement(List<RudeEditDiagnostic> diagnostics, SyntaxNode newNode)
{
diagnostics.Add(new RudeEditDiagnostic(
RudeEditKind.RUDE_EDIT_INSERT_AROUND,
RudeEditKind.InsertAroundActiveStatement,
GetDiagnosticSpan(newNode, EditKind.Insert),
newNode,
new[] { GetStatementDisplayName(newNode, EditKind.Insert) }));
......@@ -1606,7 +1606,7 @@ protected void AddRudeInsertAroundActiveStatement(List<RudeEditDiagnostic> diagn
protected void AddRudeDeleteAroundActiveStatement(List<RudeEditDiagnostic> diagnostics, SyntaxNode oldNode, SyntaxNode newActiveStatement)
{
diagnostics.Add(new RudeEditDiagnostic(
RudeEditKind.RUDE_EDIT_DELETE_AROUND,
RudeEditKind.DeleteAroundActiveStatement,
newActiveStatement.Span,
oldNode,
new[] { GetStatementDisplayName(oldNode, EditKind.Delete) }));
......
......@@ -14,21 +14,13 @@ internal static class RudeEditDiagnosticDescriptors
{
private static readonly ImmutableDictionary<RudeEditKind, DiagnosticDescriptor> s_descriptors = new List<KeyValuePair<RudeEditKind, DiagnosticDescriptor>>
{
{ GetDescriptorPair(RudeEditKind.STMT_MID_DELETE, FeaturesResources.EditingOrDeletingBeingExecuted) },
{ GetDescriptorPair(RudeEditKind.STMT_NON_LEAF_DELETE, FeaturesResources.EditingOrDeletingNotAtTheTop) },
{ GetDescriptorPair(RudeEditKind.STMT_CTOR_CALL, FeaturesResources.EditingOrDeletingConstructorDeclaration) },
{ GetDescriptorPair(RudeEditKind.STMT_FIELD_INIT, FeaturesResources.EditingOrDeletingFieldInitializer) },
{ GetDescriptorPair(RudeEditKind.STMT_DELETE, FeaturesResources.AnActiveStatementMarkerHasBeenDeleted) },
{ GetDescriptorPair(RudeEditKind.STMT_DELETE_REMAP, FeaturesResources.AnActiveStatementMarkerHasBeenDeletedAnd) },
{ GetDescriptorPair(RudeEditKind.STMT_READONLY, FeaturesResources.EditingOrCommentingOut) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_INSERT_AROUND, FeaturesResources.AddingAAroundAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_DELETE_AROUND, FeaturesResources.DeletingAAroundAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.RUDE_NO_ACTIVE_STMT, FeaturesResources.ErrorLocatingAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.RUDE_ACTIVE_STMT_DELETED, FeaturesResources.AnActiveStatementHasBeenRemoved) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_AROUND_ACTIVE_STMT, FeaturesResources.UpdatingAStatementAroundActive) },
{ GetDescriptorPair(RudeEditKind.EXC_HANDLER_ERROR, FeaturesResources.ModifyingACatchFinallyHandler) },
{ GetDescriptorPair(RudeEditKind.EXC_FINALLY_ERROR, FeaturesResources.ModifyingATryCatchFinally) },
{ GetDescriptorPair(RudeEditKind.EXC_CATCH_ERROR, FeaturesResources.ModifyingACatchHandlerAround) },
{ GetDescriptorPair(RudeEditKind.InsertAroundActiveStatement, FeaturesResources.AddingAAroundAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.DeleteAroundActiveStatement, FeaturesResources.DeletingAAroundAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.DeleteActiveStatement, FeaturesResources.AnActiveStatementHasBeenRemoved) },
{ GetDescriptorPair(RudeEditKind.UpdateAroundActiveStatement, FeaturesResources.UpdatingAStatementAroundActive) },
{ GetDescriptorPair(RudeEditKind.UpdateExceptionHandlerOfActiveTry, FeaturesResources.ModifyingACatchFinallyHandler) },
{ GetDescriptorPair(RudeEditKind.UpdateTryOrCatchWithActiveFinally, FeaturesResources.ModifyingATryCatchFinally) },
{ GetDescriptorPair(RudeEditKind.UpdateCatchHandlerAroundActiveStatement, FeaturesResources.ModifyingACatchHandlerAround) },
{ GetDescriptorPair(RudeEditKind.Update, FeaturesResources.UpdatingAWillPrevent) },
{ GetDescriptorPair(RudeEditKind.ModifiersUpdate, FeaturesResources.UpdatingTheModifiersOf) },
{ GetDescriptorPair(RudeEditKind.VarianceUpdate, FeaturesResources.UpdatingTheVarianceOf) },
......@@ -78,52 +70,19 @@ internal static class RudeEditDiagnosticDescriptors
{ GetDescriptorPair(RudeEditKind.NotAccessingCapturedVariableInLambda, FeaturesResources.NotAccessingCapturedVariableInLambda) },
{ GetDescriptorPair(RudeEditKind.InsertLambdaWithMultiScopeCapture, FeaturesResources.InsertLambdaWithMultiScopeCapture) },
{ GetDescriptorPair(RudeEditKind.DeleteLambdaWithMultiScopeCapture, FeaturesResources.DeleteLambdaWithMultiScopeCapture) },
{ GetDescriptorPair(RudeEditKind.ActiveStatementUpdate, FeaturesResources.UpdatingAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.ActiveStatementLambdaRemoved, FeaturesResources.RemovingThatContainsActiveStatement) },
{ GetDescriptorPair(RudeEditKind.InsertFile, FeaturesResources.AddingANewFile) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ANON_METHOD, FeaturesResources.ModifyingAWhichContainsAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_YIELD, FeaturesResources.ModifyingAWhichContainsYield) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_FIELD_ANON_METH, FeaturesResources.ModifyingAInitializerWithAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_NON_USER_STMT, FeaturesResources.ModifyingAContainingAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.FIELD_WITH_ANON_METHOD, FeaturesResources.ConstructorCannotBeModifiedAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_LAMBDA_EXPRESSION, FeaturesResources.ModifyingAWhichContainsLambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_QUERY_EXPRESSION, FeaturesResources.ModifyingAWhichContainsQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, FeaturesResources.ModifyingAWhichContainsAnonymousType) },
{ GetDescriptorPair(RudeEditKind.FIELD_WITH_LAMBDA, FeaturesResources.ConstructorCannotBeModifiedLambda) },
{ GetDescriptorPair(RudeEditKind.FIELD_WITH_QUERY, FeaturesResources.ConstructorCannotBeModifiedQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_FIELD_LAMBDA, FeaturesResources.ModifyingAInitializerWithLambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_FIELD_QUERY, FeaturesResources.ModifyingAInitializerWithQuery) },
{ GetDescriptorPair(RudeEditKind.FIELD_WITH_ANON_TYPE, FeaturesResources.ConstructorCannotBeModifiedAnonymousType) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_FIELD_ANON_TYPE, FeaturesResources.ModifyingAInitializerWithAnonymousType) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_DYNAMIC_INVOCATION, FeaturesResources.ModifyingAWhichContainsDynamic) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_NOPIA_USAGE, FeaturesResources.ModifyingAWhichContainsEmbeddedInterop) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MODIFY_ANON_METHOD, FeaturesResources.ModifyingAStatementWhichContainsAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ADD_ANON_METHOD, FeaturesResources.AddingAStatementWhichContainsAnAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_DELETE_ANON_METHOD, FeaturesResources.DeletingAStatementWhichContainsAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MOVE_ANON_METHOD, FeaturesResources.MovingAStatementWhichContainsAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_LOCAL_USED_IN_ANON_METHOD, FeaturesResources.ModifyingLocalReferencedInAnonymousMethod) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MODIFY_LAMBDA_EXPRESSION, FeaturesResources.ModifyingAStatementWhichContainsLambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ADD_LAMBDA_EXPRESSION, FeaturesResources.AddingAStatementWhichContainsALambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_DELETE_LAMBDA_EXPRESSION, FeaturesResources.DeletingAStatementWhichContainsLambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MOVE_LAMBDA_EXPRESSION, FeaturesResources.MovingAStatementWhichContainsLambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_LOCAL_USED_IN_LAMBDA_EXPRESSION, FeaturesResources.ModifyingLocalReferencedInLambda) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MODIFY_QUERY_EXPRESSION, FeaturesResources.ModifyingAStatementWhichContainsQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ADD_QUERY_EXPRESSION, FeaturesResources.AddingAStatementWhichContainsAQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_DELETE_QUERY_EXPRESSION, FeaturesResources.DeletingAStatementWhichContainsQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MOVE_QUERY_EXPRESSION, FeaturesResources.MovingAStatementWhichContainsQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_LOCAL_USED_IN_QUERY_EXPRESSION, FeaturesResources.ModifyingLocalReferencedInQuery) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MODIFY_ANONYMOUS_TYPE, FeaturesResources.ModifyingAStatementWhichContainsAnonymousType) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ADD_ANONYMOUS_TYPE, FeaturesResources.AddingAStatementWhichContainsAnAnonymousType) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_DELETE_ANONYMOUS_TYPE, FeaturesResources.DeletingAStatementWhichContainsAnonymousType) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_MOVE_ANONYMOUS_TYPE, FeaturesResources.MovingAStatementWhichContainsAnonymousType) },
{ GetDescriptorPair(RudeEditKind.AsyncMethodUpdate, FeaturesResources.ModifyingAnAsynchronous) },
{ GetDescriptorPair(RudeEditKind.AsyncMethodTriviaUpdate, FeaturesResources.ModifyingTriviaOfAnAsynchronous) },
{ GetDescriptorPair(RudeEditKind.ActiveStatementUpdate, FeaturesResources.UpdatingAnActiveStatement) },
{ GetDescriptorPair(RudeEditKind.ActiveStatementLambdaRemoved, FeaturesResources.RemovingThatContainsActiveStatement) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ADD_NEW_FILE, FeaturesResources.AddingANewFile) },
// VB specific,
{ GetDescriptorPair(RudeEditKind.HandlesClauseUpdate, FeaturesResources.UpdatingTheHandlesClause) },
{ GetDescriptorPair(RudeEditKind.ImplementsClauseUpdate, FeaturesResources.UpdatingTheImplementsClause) },
{ GetDescriptorPair(RudeEditKind.ConstraintKindUpdate, FeaturesResources.ChangingTheConstraintFromTo) },
{ GetDescriptorPair(RudeEditKind.RUDE_EDIT_ADD_HANDLES_CLAUSE, FeaturesResources.AddingAWithTheHandlesClause) },
{ GetDescriptorPair(RudeEditKind.InsertHandlesClause, FeaturesResources.AddingAWithTheHandlesClause) },
}.ToImmutableDictionary();
private static KeyValuePair<RudeEditKind, DiagnosticDescriptor> GetDescriptorPair(RudeEditKind kind, string message)
......
......@@ -2,12 +2,11 @@
namespace Microsoft.CodeAnalysis.EditAndContinue
{
// TODO (tomat): cleanup
// TELEMETRY: DO NOT MODIFY ANY ENUM VALUES OF THIS ENUM.
// IT WILL BREAK OUR SQM VARIABLE MAPPINGS.
internal enum RudeEditKind : ushort
{
// TELEMETRY: DO NOT MODIFY ANY ENUM VALUES BELOW THIS POINT.
// IT WILL BREAK OUR SQM VARIABLE MAPPINGS.
None = 0,
ActiveStatementUpdate = 1,
......@@ -52,14 +51,15 @@ internal enum RudeEditKind : ushort
GenericTypeTriviaUpdate = 39,
GenericTypeInitializerUpdate = 40,
PartialTypeInitializerUpdate = 41,
AsyncMethodUpdate = 42,
AsyncMethodTriviaUpdate = 43,
//// AsyncMethodUpdate = 42,
//// AsyncMethodTriviaUpdate = 43,
StackAllocUpdate = 44,
ExperimentalFeaturesEnabled = 45,
AwaitStatementUpdate = 46,
ChangingConstructorVisibility = 47,
CapturingVariable = 48,
NotCapturingVariable = 49,
DeletingCapturedVariable = 50,
......@@ -72,63 +72,24 @@ internal enum RudeEditKind : ushort
InsertLambdaWithMultiScopeCapture = 57,
DeleteLambdaWithMultiScopeCapture = 58,
// TELEMETRY: DO NOT MODIFY ANY ENUM VALUES ABOVE THIS POINT.
// IT WILL BREAK OUR SQM VARIABLE MAPPINGS.
// 59 can be used
InsertAroundActiveStatement = 60,
DeleteAroundActiveStatement = 61,
DeleteActiveStatement = 62,
UpdateAroundActiveStatement = 63,
UpdateExceptionHandlerOfActiveTry = 64,
UpdateTryOrCatchWithActiveFinally = 65,
UpdateCatchHandlerAroundActiveStatement = 66,
// 67-69 can be used
// Values below here are not mapped by sqm:
STMT_MID_DELETE = 0x100,
STMT_NON_LEAF_DELETE,
STMT_CTOR_CALL,
STMT_FIELD_INIT,
STMT_DELETE,
STMT_DELETE_REMAP,
STMT_READONLY,
RUDE_EDIT_INSERT_AROUND,
RUDE_EDIT_DELETE_AROUND,
RUDE_NO_ACTIVE_STMT,
RUDE_ACTIVE_STMT_DELETED,
RUDE_EDIT_AROUND_ACTIVE_STMT,
EXC_HANDLER_ERROR,
EXC_FINALLY_ERROR,
EXC_CATCH_ERROR,
RUDE_EDIT_NON_USER_STMT,
InsertHandlesClause = 70,
InsertFile = 71,
// anonymous types, iterators, lambdas, queries, dynamic, nopia
RUDE_EDIT_ANON_METHOD,
RUDE_EDIT_YIELD, // VB only
RUDE_EDIT_FIELD_ANON_METH,
RUDE_EDIT_DYNAMIC_INVOCATION,
RUDE_EDIT_NOPIA_USAGE,
FIELD_WITH_ANON_METHOD,
// TODO: remove values below
RUDE_EDIT_ANON_METHOD = 0x100,
RUDE_EDIT_LAMBDA_EXPRESSION,
RUDE_EDIT_QUERY_EXPRESSION,
RUDE_EDIT_ANONYMOUS_TYPE,
FIELD_WITH_LAMBDA,
FIELD_WITH_QUERY,
RUDE_EDIT_FIELD_LAMBDA,
RUDE_EDIT_FIELD_QUERY,
FIELD_WITH_ANON_TYPE,
RUDE_EDIT_FIELD_ANON_TYPE,
RUDE_EDIT_MODIFY_ANON_METHOD,
RUDE_EDIT_ADD_ANON_METHOD,
RUDE_EDIT_DELETE_ANON_METHOD,
RUDE_EDIT_MOVE_ANON_METHOD,
RUDE_EDIT_LOCAL_USED_IN_ANON_METHOD,
RUDE_EDIT_MODIFY_LAMBDA_EXPRESSION,
RUDE_EDIT_ADD_LAMBDA_EXPRESSION,
RUDE_EDIT_DELETE_LAMBDA_EXPRESSION,
RUDE_EDIT_MOVE_LAMBDA_EXPRESSION,
RUDE_EDIT_LOCAL_USED_IN_LAMBDA_EXPRESSION,
RUDE_EDIT_MODIFY_QUERY_EXPRESSION,
RUDE_EDIT_ADD_QUERY_EXPRESSION,
RUDE_EDIT_DELETE_QUERY_EXPRESSION,
RUDE_EDIT_MOVE_QUERY_EXPRESSION,
RUDE_EDIT_LOCAL_USED_IN_QUERY_EXPRESSION,
RUDE_EDIT_MODIFY_ANONYMOUS_TYPE,
RUDE_EDIT_ADD_ANONYMOUS_TYPE,
RUDE_EDIT_DELETE_ANONYMOUS_TYPE,
RUDE_EDIT_MOVE_ANONYMOUS_TYPE,
RUDE_EDIT_ADD_HANDLES_CLAUSE,
RUDE_EDIT_ADD_NEW_FILE,
}
}
......@@ -369,27 +369,6 @@
<data name="ChangeTo" xml:space="preserve">
<value>Change '{0}' to '{1}.{2}'.</value>
</data>
<data name="EditingOrDeletingBeingExecuted" xml:space="preserve">
<value>Editing or deleting an active statement which is being executed will prevent the debug session from continuing.</value>
</data>
<data name="EditingOrDeletingNotAtTheTop" xml:space="preserve">
<value>Editing or deleting an active statement which is not at the top of the callstack will prevent the debug session from continuing.</value>
</data>
<data name="EditingOrDeletingConstructorDeclaration" xml:space="preserve">
<value>Editing or deleting an active statement on a constructor declaration will prevent the debug session from continuing.</value>
</data>
<data name="EditingOrDeletingFieldInitializer" xml:space="preserve">
<value>Editing or deleting an active statement in a field initializer will prevent the debug session from continuing.</value>
</data>
<data name="AnActiveStatementMarkerHasBeenDeleted" xml:space="preserve">
<value>An active statement marker has been deleted. You must revert your changes to continue or restart the debugging session.</value>
</data>
<data name="AnActiveStatementMarkerHasBeenDeletedAnd" xml:space="preserve">
<value>An active statement marker has been deleted and cannot be remapped in the current source file. You must revert your changes to continue or restart the debugging session.</value>
</data>
<data name="EditingOrCommentingOut" xml:space="preserve">
<value>Editing or commenting out an active statement inside a readonly section will prevent the debug session from continuing.</value>
</data>
<data name="UpdatingAWillPrevent" xml:space="preserve">
<value>Updating '{0}' will prevent the debug session from continuing.</value>
</data>
......@@ -531,9 +510,6 @@
<data name="DeletingAMethodBodyWillPrevent" xml:space="preserve">
<value>Deleting a method body will prevent the debug session from continuing.</value>
</data>
<data name="ErrorLocatingAnActiveStatement" xml:space="preserve">
<value>Error locating an active statement in source file. You must restart the debugging session.</value>
</data>
<data name="AnActiveStatementHasBeenRemoved" xml:space="preserve">
<value>An active statement has been removed from its original method. You must revert your changes to continue or restart the debugging session.</value>
</data>
......@@ -576,117 +552,15 @@
<data name="ModifyingAWhichContainsAnonymousMethod" xml:space="preserve">
<value>Modifying '{0}' which contains an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAWhichContainsYield" xml:space="preserve">
<value>Modifying '{0}' which contains 'yield return' or 'yield break' statement will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAInitializerWithAnonymousMethod" xml:space="preserve">
<value>Modifying '{0}' initializer with an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAContainingAnActiveStatement" xml:space="preserve">
<value>Modifying '{0}' containing an active statement in compiler generated code will prevent the debug session from continuing.</value>
</data>
<data name="ConstructorCannotBeModifiedAnonymousMethod" xml:space="preserve">
<value>Constructor cannot be modified while debugging because field '{0}' has an initializer using an anonymous method.</value>
</data>
<data name="ModifyingAWhichContainsLambda" xml:space="preserve">
<value>Modifying '{0}' which contains a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAWhichContainsQuery" xml:space="preserve">
<value>Modifying '{0}' which contains a query expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAWhichContainsAnonymousType" xml:space="preserve">
<value>Modifying '{0}' which contains an anonymous type will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAFileWithExperimentalFeaturesEnabled" xml:space="preserve">
<value>Modifying source with experimental language features enabled will prevent the debug session from continuing.</value>
</data>
<data name="ConstructorCannotBeModifiedLambda" xml:space="preserve">
<value>Constructor cannot be modified while debugging because field '{0}' has an initializer using a lambda expression.</value>
</data>
<data name="ConstructorCannotBeModifiedQuery" xml:space="preserve">
<value>Constructor cannot be modified while debugging because field '{0}' has an initializer using a query expression.</value>
</data>
<data name="ModifyingAInitializerWithLambda" xml:space="preserve">
<value>Modifying '{0}' initializer with a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAInitializerWithQuery" xml:space="preserve">
<value>Modifying '{0}' initializer with a query expression will prevent the debug session from continuing.</value>
</data>
<data name="ConstructorCannotBeModifiedAnonymousType" xml:space="preserve">
<value>Constructor cannot be modified while debugging because field '{0}' has an initializer with an anonymous type.</value>
</data>
<data name="ModifyingAInitializerWithAnonymousType" xml:space="preserve">
<value>Modifying '{0}' initializer with an anonymous type will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAWhichContainsDynamic" xml:space="preserve">
<value>Modifying '{0}' which contains a dynamic invocation will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAWhichContainsEmbeddedInterop" xml:space="preserve">
<value>Modifying '{0}' which contains a usage of an embedded interop type/member will prevent the debug session from continuing.\r\nTo enable Edit and Continue, try setting \"Embed Interop Types\" property to \"False\" for COM references when debugging.</value>
</data>
<data name="ModifyingAStatementWhichContainsAnonymousMethod" xml:space="preserve">
<value>Modifying a statement which contains an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="AddingAStatementWhichContainsAnAnonymousMethod" xml:space="preserve">
<value>Adding a statement which contains an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="DeletingAStatementWhichContainsAnonymousMethod" xml:space="preserve">
<value>Deleting a statement which contains an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="MovingAStatementWhichContainsAnonymousMethod" xml:space="preserve">
<value>Moving a statement which contains an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingLocalReferencedInAnonymousMethod" xml:space="preserve">
<value>Modifying local '{0}' which is referenced in an anonymous method will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAStatementWhichContainsLambda" xml:space="preserve">
<value>Modifying a statement which contains a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="AddingAStatementWhichContainsALambda" xml:space="preserve">
<value>Adding a statement which contains a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="DeletingAStatementWhichContainsLambda" xml:space="preserve">
<value>Deleting a statement which contains a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="MovingAStatementWhichContainsLambda" xml:space="preserve">
<value>Moving a statement which contains a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingLocalReferencedInLambda" xml:space="preserve">
<value>Modifying local '{0}' which is referenced in a lambda expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAStatementWhichContainsQuery" xml:space="preserve">
<value>Modifying a statement which contains a query expression will prevent the debug session from continuing.</value>
</data>
<data name="AddingAStatementWhichContainsAQuery" xml:space="preserve">
<value>Adding a statement which contains a query expression will prevent the debug session from continuing.</value>
</data>
<data name="DeletingAStatementWhichContainsQuery" xml:space="preserve">
<value>Deleting a statement which contains a query expression will prevent the debug session from continuing.</value>
</data>
<data name="MovingAStatementWhichContainsQuery" xml:space="preserve">
<value>Moving a statement which contains a query expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingLocalReferencedInQuery" xml:space="preserve">
<value>Modifying local '{0}' which is referenced in a query expression will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAStatementWhichContainsAnonymousType" xml:space="preserve">
<value>Modifying a statement which contains an anonymous type will prevent the debug session from continuing.</value>
</data>
<data name="AddingAStatementWhichContainsAnAnonymousType" xml:space="preserve">
<value>Adding a statement which contains an anonymous type will prevent the debug session from continuing.</value>
</data>
<data name="DeletingAStatementWhichContainsAnonymousType" xml:space="preserve">
<value>Deleting a statement which contains an anonymous type will prevent the debug session from continuing.</value>
</data>
<data name="MovingAStatementWhichContainsAnonymousType" xml:space="preserve">
<value>Moving a statement which contains an anonymous type will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingAnAsynchronous" xml:space="preserve">
<value>Modifying an asynchronous '{0}' will prevent the debug session from continuing.</value>
</data>
<data name="ModifyingTriviaOfAnAsynchronous" xml:space="preserve">
<value>Modifying whitespace or comments in an asynchronous '{0}' will prevent the debug session from continuing.</value>
</data>
<data name="UpdatingAnActiveStatement" xml:space="preserve">
<value>Updating an active statement will prevent the debug session from continuing.</value>
</data>
......
......@@ -1860,7 +1860,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
End If
If method.HandlesClause IsNot Nothing Then
ReportError(RudeEditKind.RUDE_EDIT_ADD_HANDLES_CLAUSE)
ReportError(RudeEditKind.InsertHandlesClause)
End If
ClassifyModifiedMemberInsert(method.Modifiers)
......@@ -2569,10 +2569,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue
Case SyntaxKind.QueryExpression
ReportError(RudeEditKind.RUDE_EDIT_QUERY_EXPRESSION, node, Me.newNode)
Return
Case SyntaxKind.AnonymousObjectCreationExpression
ReportError(RudeEditKind.RUDE_EDIT_ANONYMOUS_TYPE, node, Me.newNode)
Return
End Select
Next
End Sub
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册