diff --git a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs index 367a7dbf00db9b42ceb64dbcd6b2bbf6e58df045..b020f7bd3057864e96f61ed5f734fef9babf327d 100644 --- a/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs +++ b/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.cs @@ -2908,12 +2908,6 @@ internal bool EnableEnumArrayBlockInitialization return sustainedLowLatency != null && sustainedLowLatency.ContainingAssembly == Assembly.CorLibrary; } } - - internal override bool IsIOperationFeatureEnabled() - { - var options = (CSharpParseOptions)this.SyntaxTrees.FirstOrDefault()?.Options; - return options?.IsFeatureEnabled(MessageID.IDS_FeatureIOperation) ?? false; - } private class SymbolSearcher { diff --git a/src/Compilers/CSharp/Portable/Errors/MessageID.cs b/src/Compilers/CSharp/Portable/Errors/MessageID.cs index f35ff727b198ceca7843bddb379ddbaf8b4bd3e3..069010289184057ac9f2f0d87b7e987c71c6de44 100644 --- a/src/Compilers/CSharp/Portable/Errors/MessageID.cs +++ b/src/Compilers/CSharp/Portable/Errors/MessageID.cs @@ -119,8 +119,6 @@ internal enum MessageID IDS_FeatureLocalFunctions = MessageBase + 12708, IDS_FeatureRefLocalsReturns = MessageBase + 12710, - - IDS_FeatureIOperation = MessageBase + 12711, } // Message IDs may refer to strings that need to be localized. @@ -176,8 +174,6 @@ internal static string RequiredFeature(this MessageID feature) return "patterns"; case MessageID.IDS_FeaturePatternMatching2: return "patternsExperimental"; - case MessageID.IDS_FeatureIOperation: - return "IOperation"; default: return null; } diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs index eb5b9297e70a3d4b939344dfcd95943a276eb993..1bb0c24e3ffe88af1d76cd94fd6004699a666467 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/DiagnosticAnalyzerTests.cs @@ -892,7 +892,7 @@ public void TestReportingDiagnosticWithInvalidLocation() { var source1 = @"class C1 { void M() { int i = 0; i++; } }"; var source2 = @"class C2 { void M() { int i = 0; i++; } }"; - var compilation = CreateCompilationWithMscorlib45(source1, parseOptions: TestOptions.RegularWithIOperationFeature); + var compilation = CreateCompilationWithMscorlib45(source1); var anotherCompilation = CreateCompilationWithMscorlib45(source2); var treeInAnotherCompilation = anotherCompilation.SyntaxTrees.Single(); diff --git a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs index 5c312e982d8dfa972a6eb76dfe352118de25255a..318acff698e27263d7f08802b21367f4f83dbb38 100644 --- a/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs +++ b/src/Compilers/CSharp/Test/Semantic/Diagnostics/OperationAnalyzerTests.cs @@ -35,7 +35,7 @@ void M1() int[,][] arr12 = new int[0,0][]; // no } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new EmptyArrayAnalyzer() }, null, null, false, Diagnostic(EmptyArrayAnalyzer.UseArrayEmptyDescriptor.Id, "new int[0]").WithLocation(6, 22), @@ -97,7 +97,7 @@ class D object OField = 33; object SField = ""Zap""; }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BoxingOperationAnalyzer() }, null, null, false, Diagnostic(BoxingOperationAnalyzer.BoxingDescriptor.Id, "3").WithLocation(9, 25), @@ -128,7 +128,7 @@ public void M1(int z) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BadStuffTestAnalyzer() }, null, null, false, Diagnostic(BadStuffTestAnalyzer.IsInvalidDescriptor.Id, "Framitz()").WithLocation(6, 9), Diagnostic(BadStuffTestAnalyzer.InvalidExpressionDescriptor.Id, "Framitz").WithLocation(6, 9), @@ -165,7 +165,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new BigForTestAnalyzer() }, null, null, false, Diagnostic(BigForTestAnalyzer.BigForDescriptor.Id, "for (x = 0; x < 2000000; x++) {}").WithLocation(9, 9), @@ -229,7 +229,7 @@ public void M1(int x, int y) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_EmptySwitch, "{").WithLocation(40, 20), Diagnostic(ErrorCode.ERR_ConstantExpected, ":").WithLocation(44, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SwitchTestAnalyzer() }, null, null, false, @@ -295,7 +295,7 @@ public void M6() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new InvocationTestAnalyzer() }, null, null, false, Diagnostic(InvocationTestAnalyzer.OutOfNumericalOrderArgumentsDescriptor.Id, "2").WithLocation(16, 21), @@ -377,7 +377,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new FieldCouldBeReadOnlyAnalyzer() }, null, null, false, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(8, 9), @@ -450,7 +450,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new FieldCouldBeReadOnlyAnalyzer() }, null, null, false, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(8, 16), @@ -506,7 +506,7 @@ class C1 } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LocalCouldBeConstAnalyzer() }, null, null, false, Diagnostic(LocalCouldBeConstAnalyzer.LocalCouldBeConstDescriptor.Id, "e").WithLocation(13, 13), @@ -678,7 +678,7 @@ interface IDerived : IMiddle, IBase2 } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SymbolCouldHaveMoreSpecificTypeAnalyzer() }, null, null, false, Diagnostic(SymbolCouldHaveMoreSpecificTypeAnalyzer.LocalCouldHaveMoreSpecificTypeDescriptor.Id, "a").WithArguments("a", "Middle").WithLocation(6, 16), @@ -744,7 +744,7 @@ enum E D = 18 } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new SeventeenTestAnalyzer() }, null, null, false, Diagnostic(SeventeenTestAnalyzer.SeventeenDescriptor.Id, "17").WithLocation(4, 40), @@ -785,7 +785,7 @@ public void M3() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NullArgumentTestAnalyzer() }, null, null, false, Diagnostic(NullArgumentTestAnalyzer.NullArgumentsDescriptor.Id, "null").WithLocation(16, 12), @@ -827,7 +827,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (25,30): error CS1010: Newline in constant // var e2 = new Foo() { " }; @@ -889,7 +889,7 @@ public void M2() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AssignmentTestAnalyzer() }, null, null, false, Diagnostic(AssignmentTestAnalyzer.DoNotUseMemberAssignmentDescriptor.Id, "x1.Field = 10").WithLocation(28, 9), @@ -930,7 +930,7 @@ void M1() int[][] arr14 = new int[][] { new int[] { 1,2,3 }, new[] { 1, 2, 3, 4, 5, 6 } }; // LargeList } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ArrayInitializerTestAnalyzer() }, null, null, false, Diagnostic(ArrayInitializerTestAnalyzer.DoNotUseLargeListOfArrayInitializersDescriptor.Id, "{ 1, 2, 3, 4, 5, 6 }").WithLocation(14, 32), @@ -964,7 +964,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( Diagnostic(ErrorCode.ERR_IdentifierExpected, ";").WithLocation(12, 25), Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(13, 29)) @@ -1029,7 +1029,7 @@ public void M1(int x, int y) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_EmptySwitch, "{").WithLocation(37, 20), Diagnostic(ErrorCode.ERR_ConstantExpected, ":").WithLocation(41, 18)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new CaseTestAnalyzer() }, null, null, false, @@ -1071,7 +1071,7 @@ public override void M1() M2(); } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ExplicitVsImplicitInstanceAnalyzer() }, null, null, false, Diagnostic(ExplicitVsImplicitInstanceAnalyzer.ExplicitInstanceDescriptor.Id, "this").WithLocation(6, 9), @@ -1108,7 +1108,7 @@ private void Mumbler(object sender, System.EventArgs args) { } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new MemberReferenceAnalyzer() }, null, null, false, Diagnostic(MemberReferenceAnalyzer.HandlerAddedDescriptor.Id, "Mumble += new MumbleEventHandler(Mumbler)").WithLocation(10, 9), @@ -1172,7 +1172,7 @@ public D(string a, params int[] b) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ParamsArrayTestAnalyzer() }, null, null, false, Diagnostic(ParamsArrayTestAnalyzer.LongParamsDescriptor.Id, "2").WithLocation(13, 15), @@ -1202,7 +1202,7 @@ class C static int Bar(int P1 = 15, int F2 = 33) { return P1 + F2; } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new EqualsValueTestAnalyzer() }, null, null, false, Diagnostic(EqualsValueTestAnalyzer.EqualsValueDescriptor.Id, "= 44").WithLocation(4, 19), @@ -1234,7 +1234,7 @@ public void FunkyMethod() public int UnFunkyField = 12; } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new OwningSymbolTestAnalyzer() }, null, null, false, Diagnostic(OwningSymbolTestAnalyzer.ExpressionDescriptor.Id, "0").WithLocation(12, 17), @@ -1258,7 +1258,7 @@ public void M0() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NoneOperationTestAnalyzer() }, null, null, false); } @@ -1297,7 +1297,7 @@ public static long Calculate1(long[] f) } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new AssignmentOperationSyntaxTestAnalyzer() }, null, null, true, Diagnostic("AD0002").WithArguments("System.InsufficientExecutionStackException", "Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.").WithLocation(1, 1), @@ -1346,7 +1346,7 @@ public unsafe void M1() private int _i = 0; }"; - CreateCompilationWithMscorlib45(source, options: TestOptions.UnsafeReleaseDll, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source, options: TestOptions.UnsafeReleaseDll) .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_InvalidAddrOp, "a + b").WithLocation(7, 18), Diagnostic(ErrorCode.ERR_AddrOnReadOnlyLocal, "i").WithLocation(28, 23), Diagnostic(ErrorCode.ERR_AddrOnReadOnlyLocal, "i").WithLocation(33, 24)) @@ -1394,7 +1394,7 @@ public void OnMumble(System.EventArgs args) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LambdaTestAnalyzer() }, null, null, false, Diagnostic(LambdaTestAnalyzer.LambdaExpressionDescriptor.Id, "input => { }").WithLocation(8, 31), @@ -1444,7 +1444,7 @@ void Foo() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_UnreferencedEvent, "E").WithArguments("D.E").WithLocation(6, 32)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new StaticMemberTestAnalyzer() }, null, null, false, Diagnostic(StaticMemberTestAnalyzer.StaticMemberDescriptor.Id, "C.E += D.Method").WithLocation(23, 9), @@ -1471,7 +1471,7 @@ public void Fred() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LabelOperationsTestAnalyzer() }, null, null, false, Diagnostic(LabelOperationsTestAnalyzer.LabelDescriptor.Id, "Wilma: goto Betty;").WithLocation(6, 9), @@ -1531,7 +1531,7 @@ static void Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new UnaryAndBinaryOperationsTestAnalyzer() }, null, null, false, Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.BooleanNotDescriptor.Id, "!b").WithLocation(41, 13), @@ -1578,7 +1578,7 @@ static void Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.ERR_BadBinaryOps, "x + 10", new object[] { "+", "A", "int"}).WithLocation(29, 13), Diagnostic(ErrorCode.ERR_BadUnaryOp, "-x", new object[] { "-", "A"}).WithLocation(31, 13)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new OperatorPropertyPullerTestAnalyzer() }, null, null, false, @@ -1609,7 +1609,7 @@ public void M1() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new NullOperationSyntaxTestAnalyzer() }, null, null, false, Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "M0()").WithLocation(10, 9), @@ -1635,7 +1635,7 @@ static void Main() int i = global::MyType(); } }"; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (8,17): error CS0023: Operator '.' cannot be applied to operand of type '' // int x = null.Length; @@ -1675,7 +1675,7 @@ public void Increment(string f) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( Diagnostic(ErrorCode.ERR_NoSuchMember, "Nan").WithArguments("float", "Nan").WithLocation(6, 27), Diagnostic(ErrorCode.ERR_BadUnaryOp, "-f").WithArguments("-", "string").WithLocation(11, 16), @@ -1703,7 +1703,7 @@ public static int Main() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics( // (4,28): error CS0225: The params parameter must be a single dimensional array // public static void Foo(params int a) {} @@ -1754,7 +1754,7 @@ public void M0(C p) } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new ConditionalAccessOperationTestAnalyzer() }, null, null, false, Diagnostic(ConditionalAccessOperationTestAnalyzer.ConditionalAccessOperationDescriptor.Id, "p?.Prop").WithLocation(24, 17), @@ -1800,7 +1800,7 @@ struct S } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics(Diagnostic(ErrorCode.WRN_UnreferencedVarAssg, "a").WithArguments("a").WithLocation(6, 16)) .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new LiteralTestAnalyzer() }, null, null, false, Diagnostic("Literal", "null").WithArguments("null").WithLocation(6, 20), @@ -1849,51 +1849,11 @@ public void M() } } "; - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) + CreateCompilationWithMscorlib45(source) .VerifyDiagnostics() .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new TrueFalseUnaryOperationTestAnalyzer() }, null, null, false, Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x && y").WithLocation(29, 13), Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x").WithLocation(30, 18)); } - - [Fact, WorkItem(9202, "https://github.com/dotnet/roslyn/issues/9202")] - public void IOperationFeatureFlagCSharp() - { - const string source = @" -public class A -{ - public void M() - { - var a = 1; - } -} - -"; - // with IOperation disabled (by default) - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new IOperationFeatureFlagTestAnalyzer1() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.IOperationFeatureFlagTestAnalyzer1", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new IOperationFeatureFlagTestAnalyzer2() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.IOperationFeatureFlagTestAnalyzer2", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - CreateCompilationWithMscorlib45(source) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new IOperationFeatureFlagTestAnalyzer3() }, null, null, true, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.IOperationFeatureFlagTestAnalyzer3", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)); - - // with IOperation enabled - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new IOperationFeatureFlagTestAnalyzer1() }, null, null, true, - Diagnostic(IOperationFeatureFlagTestAnalyzer1.OperationActionDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new IOperationFeatureFlagTestAnalyzer2() }, null, null, true, - Diagnostic(IOperationFeatureFlagTestAnalyzer2.OperationActionDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(6, 17)); - - CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.RegularWithIOperationFeature) - .VerifyAnalyzerDiagnostics(new DiagnosticAnalyzer[] { new IOperationFeatureFlagTestAnalyzer3() }, null, null, true, - Diagnostic(IOperationFeatureFlagTestAnalyzer3.GetOperationDescriptor.Id, "1").WithLocation(6, 17)); - } } } \ No newline at end of file diff --git a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/AnalysisContextInfoTests.cs b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/AnalysisContextInfoTests.cs index 3ce2e829f197064788c108ce209b4e063b16ce04..d2f2b2d761517efe4e65c6beba729957e1b92416 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/AnalysisContextInfoTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/AnalysisContextInfoTests.cs @@ -1,9 +1,7 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Semantics; @@ -18,9 +16,7 @@ public class AnalysisContextInfoTests public void InitializeTest() { var code = @"class C { void M() { return; } }"; - var parseOptions = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None) - .WithFeatures(new[] { new KeyValuePair("IOperation", "true") }); - var compilation = CreateCompilation(code, parseOptions: parseOptions); + var compilation = CreateCompilation(code); Verify(compilation, nameof(AnalysisContext.RegisterCodeBlockAction)); Verify(compilation, nameof(AnalysisContext.RegisterCodeBlockStartAction)); @@ -97,12 +93,12 @@ private static DiagnosticDescriptor GetRule(string id) isEnabledByDefault: true); } - private static Compilation CreateCompilation(string source, CSharpParseOptions parseOptions = null) + private static Compilation CreateCompilation(string source) { string fileName = "Test.cs"; string projectName = "TestProject"; - var syntaxTree = CSharpSyntaxTree.ParseText(source, path: fileName, options: parseOptions); + var syntaxTree = CSharpSyntaxTree.ParseText(source, path: fileName); return CSharpCompilation.Create( projectName, diff --git a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs index 9b4b778601f39f6ccc327297f6998b3737e6a9ce..ed551eb02ff048ce58a77ed7121a6ed3c82d94d3 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs +++ b/src/Compilers/Core/CodeAnalysisTest/Diagnostics/OperationTestAnalyzer.cs @@ -2097,110 +2097,4 @@ public sealed override void Initialize(AnalysisContext context) OperationKind.LiteralExpression); } } - - // This analyzer is to test operation action registration method in AnalysisContext - public class IOperationFeatureFlagTestAnalyzer1 : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - public static readonly DiagnosticDescriptor OperationActionDescriptor = new DiagnosticDescriptor( - "OperationAction1", - "An operation related action is invoked", - "An {0} action is invoked in {1} context.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(OperationActionDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterOperationAction( - (operationContext) => - { - operationContext.ReportDiagnostic( - Diagnostic.Create(OperationActionDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "Analysis")); - }, - OperationKind.LiteralExpression); - } - } - - // This analyzer is to test operation action registration method in CompilationStartAnalysisContext - public class IOperationFeatureFlagTestAnalyzer2 : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - public static readonly DiagnosticDescriptor OperationActionDescriptor = new DiagnosticDescriptor( - "OperationAction2", - "An operation related action is invoked", - "An {0} action is invoked in {1} context.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(OperationActionDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterCompilationStartAction( - (compilationStartContext) => - { - compilationStartContext.RegisterOperationAction( - (operationContext) => - { - operationContext.ReportDiagnostic( - Diagnostic.Create(OperationActionDescriptor, operationContext.Operation.Syntax.GetLocation(), "Operation", "CompilationStart within Analysis")); - }, - OperationKind.LiteralExpression); - }); - } - } - - // This analyzer is to test GetOperation method in SemanticModel - public class IOperationFeatureFlagTestAnalyzer3 : DiagnosticAnalyzer - { - private const string ReliabilityCategory = "Reliability"; - - - public static readonly DiagnosticDescriptor GetOperationDescriptor = new DiagnosticDescriptor( - "GetOperation", - "An IOperation is returned by SemanticModel", - "An IOperation is returned by SemanticModel.", - ReliabilityCategory, - DiagnosticSeverity.Warning, - isEnabledByDefault: true); - - - public sealed override ImmutableArray SupportedDiagnostics - => ImmutableArray.Create(GetOperationDescriptor); - - public sealed override void Initialize(AnalysisContext context) - { - context.RegisterSyntaxNodeAction( - (syntaxContext) => - { - var node = syntaxContext.Node; - var model = syntaxContext.SemanticModel; - if (model.GetOperation(node) != null) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(GetOperationDescriptor, node.GetLocation())); - } - }, - Microsoft.CodeAnalysis.CSharp.SyntaxKind.NumericLiteralExpression); - - context.RegisterSyntaxNodeAction( - (syntaxContext) => - { - var node = syntaxContext.Node; - var model = syntaxContext.SemanticModel; - if (model.GetOperation(node) != null) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(GetOperationDescriptor, node.GetLocation())); - } - }, - Microsoft.CodeAnalysis.VisualBasic.SyntaxKind.NumericLiteralExpression); - } - } } \ No newline at end of file diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs index 27792ee2c912fb88aa52a0f5e8f37344d4e0fc73..9568c6ad81a0a02eeb5a3a3feead8f611ffafb0f 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.Designer.cs @@ -712,15 +712,6 @@ internal class CodeAnalysisResources { } } - /// - /// Looks up a localized string similar to Feature 'IOperation' is disabled.. - /// - internal static string IOperationFeatureDisabled { - get { - return ResourceManager.GetString("IOperationFeatureDisabled", resourceCulture); - } - } - /// /// Looks up a localized string similar to Argument to '/keepalive' option is not a 32-bit integer.. /// diff --git a/src/Compilers/Core/Portable/CodeAnalysisResources.resx b/src/Compilers/Core/Portable/CodeAnalysisResources.resx index 10c2ef376aae2eca00b41f96607e69b0c07d0b1f..923b065ba79fa2246ab9900e1887155f3e87c0e9 100644 --- a/src/Compilers/Core/Portable/CodeAnalysisResources.resx +++ b/src/Compilers/Core/Portable/CodeAnalysisResources.resx @@ -513,7 +513,4 @@ Exception occurred with following context: {0} - - Feature 'IOperation' is disabled. - \ No newline at end of file diff --git a/src/Compilers/Core/Portable/Compilation/Compilation.cs b/src/Compilers/Core/Portable/Compilation/Compilation.cs index cdbe4751f7c38187bbc03eccbd51b07bdc4c2a19..3473ec5e42959b520a7b7ebb403d49581f86bd68 100644 --- a/src/Compilers/Core/Portable/Compilation/Compilation.cs +++ b/src/Compilers/Core/Portable/Compilation/Compilation.cs @@ -2217,7 +2217,5 @@ internal bool IsTypeMissing(WellKnownType type) { return _lazyMakeWellKnownTypeMissingMap != null && _lazyMakeWellKnownTypeMissingMap.ContainsKey((int)type); } - - internal abstract bool IsIOperationFeatureEnabled(); } } diff --git a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs index 96976e2cbca60c5703b1ffb615679895e3a2dd73..7e657913010e0598efd6db4c67dce62ae96e8ffe 100644 --- a/src/Compilers/Core/Portable/Compilation/SemanticModel.cs +++ b/src/Compilers/Core/Portable/Compilation/SemanticModel.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -72,19 +71,7 @@ public SyntaxTree SyntaxTree /// public IOperation GetOperation(SyntaxNode node, CancellationToken cancellationToken = default(CancellationToken)) { - if (this.Compilation.IsIOperationFeatureEnabled()) - { - try - { - return GetOperationCore(node, cancellationToken); - } - catch (Exception e) when (FatalError.ReportWithoutCrashUnlessCanceled(e)) - { - // Log a Non-fatal-watson and then ignore the crash in the attempt of getting operation - } - return null; - } - throw new InvalidOperationException(CodeAnalysisResources.IOperationFeatureDisabled); + return this.GetOperationCore(node, cancellationToken); } protected abstract IOperation GetOperationCore(SyntaxNode node, CancellationToken cancellationToken); diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs index 3652edff6f3ffa40a10632950020d6d7073c4b93..d42191d2ac5d5b506dfd62fe07a8fedd85dbc984 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs @@ -1422,7 +1422,7 @@ private bool ShouldExecuteOperationBlockActions(AnalysisScope analysisScope, ISy var symbol = symbolEvent.Symbol; var executeSyntaxNodeActions = ShouldExecuteSyntaxNodeActions(analysisScope); var executeCodeBlockActions = ShouldExecuteCodeBlockActions(analysisScope, symbol); - var executeOperationActions = this.analyzerExecutor.Compilation.IsIOperationFeatureEnabled() && ShouldExecuteOperationActions(analysisScope); + var executeOperationActions = ShouldExecuteOperationActions(analysisScope); var executeOperationBlockActions = ShouldExecuteOperationBlockActions(analysisScope, symbol); if (executeSyntaxNodeActions || executeOperationActions || executeCodeBlockActions || executeOperationBlockActions) diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs index d6b9e5ded9dfac403146ff82cfaf0f5ce300ff56..c102ec3638bad6d43f51a6cf2164a822a80904a6 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerExecutor.cs @@ -200,7 +200,7 @@ public void ExecuteInitializeMethod(DiagnosticAnalyzer analyzer, HostSessionStar { // The Initialize method should be run asynchronously in case it is not well behaved, e.g. does not terminate. ExecuteAndCatchIfThrows(analyzer, - () => analyzer.Initialize(new AnalyzerAnalysisContext(analyzer, sessionScope, _compilation.IsIOperationFeatureEnabled()))); + () => analyzer.Initialize(new AnalyzerAnalysisContext(analyzer, sessionScope))); } /// diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs index bb85b02e96442f313bd18443212f99e888a14acb..d9c0a59e615890c8819367f93ecd26f61065f0ca 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticAnalysisContextHelpers.cs @@ -70,14 +70,6 @@ internal static void VerifyDiagnosticLocationsInCompilation(Diagnostic diagnosti } } } - - internal static void VerifyIOperationFeatureFlag(bool isIOperationFeatureEnabled) - { - if (!isIOperationFeatureEnabled) - { - throw new InvalidOperationException(CodeAnalysisResources.IOperationFeatureDisabled); - } - } private static void VerifyDiagnosticLocationInCompilation(string id, Location location, Compilation compilation) { diff --git a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs index 8e6dfb11c70302dc013c008bb1d7e6ceceedae18..428b86cf3434521c5050dadfff9c07e6f22b6abe 100644 --- a/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs +++ b/src/Compilers/Core/Portable/DiagnosticAnalyzer/DiagnosticStartAnalysisScope.cs @@ -17,14 +17,11 @@ internal sealed class AnalyzerAnalysisContext : AnalysisContext { private readonly DiagnosticAnalyzer _analyzer; private readonly HostSessionStartAnalysisScope _scope; - - private readonly bool _isIOperationFeatureEnabled; - public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope, bool isIOperationFeatureEnabled = false) + public AnalyzerAnalysisContext(DiagnosticAnalyzer analyzer, HostSessionStartAnalysisScope scope) { _analyzer = analyzer; _scope = scope; - _isIOperationFeatureEnabled = isIOperationFeatureEnabled; } public override void RegisterCompilationStartAction(Action action) @@ -77,21 +74,18 @@ public override void RegisterSyntaxNodeAction(Action action, ImmutableArray operationKinds) { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); DiagnosticAnalysisContextHelpers.VerifyArguments(action, operationKinds); _scope.RegisterOperationAction(_analyzer, action, operationKinds); } public override void RegisterOperationBlockStartAction(Action action) { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockStartAction(_analyzer, action); } public override void RegisterOperationBlockAction(Action action) { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockAction(_analyzer, action); } @@ -115,8 +109,6 @@ internal sealed class AnalyzerCompilationStartAnalysisContext : CompilationStart private readonly DiagnosticAnalyzer _analyzer; private readonly HostCompilationStartAnalysisScope _scope; private readonly CompilationAnalysisValueProviderFactory _compilationAnalysisValueProviderFactory; - - private readonly bool _isIOperationFeatureEnabled; public AnalyzerCompilationStartAnalysisContext( DiagnosticAnalyzer analyzer, @@ -130,7 +122,6 @@ internal sealed class AnalyzerCompilationStartAnalysisContext : CompilationStart _analyzer = analyzer; _scope = scope; _compilationAnalysisValueProviderFactory = compilationAnalysisValueProviderFactory; - _isIOperationFeatureEnabled = compilation.IsIOperationFeatureEnabled(); } public override void RegisterCompilationEndAction(Action action) @@ -170,20 +161,17 @@ public override void RegisterSyntaxNodeAction(Action action) { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); _scope.RegisterOperationBlockStartAction(_analyzer, action); } public override void RegisterOperationBlockAction(Action action) { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); DiagnosticAnalysisContextHelpers.VerifyArguments(action); _scope.RegisterOperationBlockAction(_analyzer, action); } public override void RegisterOperationAction(Action action, ImmutableArray operationKinds) { - DiagnosticAnalysisContextHelpers.VerifyIOperationFeatureFlag(_isIOperationFeatureEnabled); _scope.RegisterOperationAction(_analyzer, action, operationKinds); } diff --git a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs index 2605c9e6b18c11cd52bb4498e9124b74a864ca77..ef8ef482a22bf6366bb0d907719dc2930975717b 100644 --- a/src/Compilers/Test/Utilities/CSharp/TestOptions.cs +++ b/src/Compilers/Test/Utilities/CSharp/TestOptions.cs @@ -13,9 +13,7 @@ public static class TestOptions public static readonly CSharpParseOptions Script = new CSharpParseOptions(kind: SourceCodeKind.Script, documentationMode: DocumentationMode.None); public static readonly CSharpParseOptions Regular = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None); public static readonly CSharpParseOptions RegularWithDocumentationComments = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.Diagnose); - - public static readonly CSharpParseOptions RegularWithIOperationFeature = Regular.WithIOperationsFeature(); - + private static readonly SmallDictionary s_experimentalFeatures = new SmallDictionary { { "localFunctions", "true" }, { "refLocalsAndReturns", "true" } }; public static readonly CSharpParseOptions ExperimentalParseOptions = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None, languageVersion: LanguageVersion.CSharp6).WithFeatures(s_experimentalFeatures); @@ -65,10 +63,5 @@ public static CSharpParseOptions WithRefsFeature(this CSharpParseOptions options { return options.WithFeature("refLocalsAndReturns", "true"); } - - public static CSharpParseOptions WithIOperationsFeature(this CSharpParseOptions options) - { - return options.WithFeature("IOperation", "true"); - } } } diff --git a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb index ed7d40e1e6497ac3dec3b85c73e09313ed4050a2..65c857af7e8eecf0fb2384a5486e956eaf32765d 100644 --- a/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb +++ b/src/Compilers/Test/Utilities/VisualBasic/TestOptions.vb @@ -6,8 +6,6 @@ Public Class TestOptions Public Shared ReadOnly Script As New VisualBasicParseOptions(kind:=SourceCodeKind.Script) Public Shared ReadOnly Regular As New VisualBasicParseOptions(kind:=SourceCodeKind.Regular) - Public Shared ReadOnly RegularWithIOperationFeature As VisualBasicParseOptions = Regular.WithIOperationFeature() - Public Shared ReadOnly ReleaseDll As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary, optimizationLevel:=OptimizationLevel.Release).WithExtendedCustomDebugInformation(True) Public Shared ReadOnly ReleaseExe As VisualBasicCompilationOptions = New VisualBasicCompilationOptions(OutputKind.ConsoleApplication, optimizationLevel:=OptimizationLevel.Release).WithExtendedCustomDebugInformation(True) @@ -47,9 +45,4 @@ Friend Module TestOptionExtensions Public Function WithDeterministicFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions Return options.WithFeature("Deterministic", "true") End Function - - - Public Function WithIOperationFeature(options As VisualBasicParseOptions) As VisualBasicParseOptions - Return options.WithFeature("IOperation", "true") - End Function End Module diff --git a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb index 15305add050dabd1fec1e87cb830583ed2a77499..2ee190c4d291d53de4c5dbd3f96508636cd4ec12 100644 --- a/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb +++ b/src/Compilers/VisualBasic/Portable/Compilation/VisualBasicCompilation.vb @@ -2646,15 +2646,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return New SymbolSearcher(Me).GetSymbolsWithName(predicate, filter, cancellationToken) End Function - - Friend Overrides Function IsIOperationFeatureEnabled() As Boolean - Dim options = DirectCast(Me.SyntaxTrees.First().Options, VisualBasicParseOptions) - Dim IOperationFeatureFlag = InternalSyntax.FeatureExtensions.GetFeatureFlag(InternalSyntax.Feature.IOperation) - If IOperationFeatureFlag IsNot Nothing Then - Return options.Features.ContainsKey(IOperationFeatureFlag) - End If - Return False - End Function #End Region Private Class SymbolSearcher diff --git a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb index e9f1d3d3894f31b450796204c7533a884268e4f6..e54f8f369bd694c2eea8b78b067d83b6b5196f38 100644 --- a/src/Compilers/VisualBasic/Portable/Errors/Errors.vb +++ b/src/Compilers/VisualBasic/Portable/Errors/Errors.vb @@ -1954,6 +1954,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic FEATURE_ImplementingReadonlyOrWriteonlyPropertyWithReadwrite FEATURE_DigitSeparators FEATURE_BinaryLiterals - FEATURE_IOperation End Enum End Namespace diff --git a/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb b/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb index e9304d945a871bcd1949d0b6fde81c3b79d603ba..3e513754a43dda0ad75f13f81a9defd2297011d7 100644 --- a/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb +++ b/src/Compilers/VisualBasic/Portable/Parser/ParserFeature.vb @@ -31,7 +31,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax ImplementingReadonlyOrWriteonlyPropertyWithReadwrite DigitSeparators BinaryLiterals - IOperation End Enum Friend Module FeatureExtensions @@ -41,12 +40,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Case Feature.DigitSeparators Return "digitSeparators" - Case feature.BinaryLiterals + Case Feature.BinaryLiterals Return "binaryLiterals" - Case Feature.IOperation - Return "IOperation" - Case Else Return Nothing End Select @@ -145,8 +141,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax Return ERRID.FEATURE_DigitSeparators Case Feature.BinaryLiterals Return ERRID.FEATURE_BinaryLiterals - Case Feature.IOperation - Return ERRID.FEATURE_IOperation Case Else Throw ExceptionUtilities.UnexpectedValue(feature) End Select diff --git a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/IOperationTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/IOperationTests.vb index 6559413e9d1aed8ddb3e08dd0c1329cf42902aa4..934d39f8a3926f104dd7edcf0d776f4a240e465b 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/IOperationTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/IOperationTests.vb @@ -50,7 +50,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) Dim nodes = tree.GetRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray() @@ -140,7 +140,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) Dim tree = comp.SyntaxTrees.Single() Dim model = comp.GetSemanticModel(tree) Dim nodes = tree.GetRoot().DescendantNodes().OfType(Of AssignmentStatementSyntax).ToArray() diff --git a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb index c73793f2e4615dd829548e125b7c92e745933ce9..5cbd031b7dc100fa284821ce603b295c75773562 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/Diagnostics/OperationAnalyzerTests.vb @@ -38,7 +38,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New EmptyArrayAnalyzer}, Nothing, Nothing, False, Diagnostic(EmptyArrayAnalyzer.UseArrayEmptyDescriptor.Id, "New Integer(-1) { }").WithLocation(3, 33), @@ -89,7 +89,7 @@ End Structure - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BoxingOperationAnalyzer}, Nothing, Nothing, False, Diagnostic(BoxingOperationAnalyzer.BoxingDescriptor.Id, "3").WithLocation(6, 32), @@ -120,7 +120,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyAnalyzerDiagnostics({New BadStuffTestAnalyzer}, Nothing, Nothing, False, Diagnostic(BadStuffTestAnalyzer.InvalidExpressionDescriptor.Id, "Framitz()").WithLocation(3, 9), Diagnostic(BadStuffTestAnalyzer.IsInvalidDescriptor.Id, "Framitz()").WithLocation(3, 9), @@ -150,7 +150,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BigForTestAnalyzer}, Nothing, Nothing, False, Diagnostic(BigForTestAnalyzer.BigForDescriptor.Id, "For x = 1 To 2000000 : Next").WithLocation(5, 9), @@ -244,7 +244,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(60, 17), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(68, 1), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(74, 22)) @@ -297,7 +297,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New InvocationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(InvocationTestAnalyzer.OutOfNumericalOrderArgumentsDescriptor.Id, "2").WithLocation(11, 21), @@ -367,7 +367,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New FieldCouldBeReadOnlyAnalyzer}, Nothing, Nothing, False, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(6, 12), @@ -433,7 +433,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New FieldCouldBeReadOnlyAnalyzer}, Nothing, Nothing, False, Diagnostic(FieldCouldBeReadOnlyAnalyzer.FieldCouldBeReadOnlyDescriptor.Id, "F5").WithLocation(6, 19), @@ -487,7 +487,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LocalCouldBeConstAnalyzer}, Nothing, Nothing, False, Diagnostic(LocalCouldBeConstAnalyzer.LocalCouldBeConstDescriptor.Id, "e").WithLocation(10, 13), @@ -652,7 +652,7 @@ End Interface - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New SymbolCouldHaveMoreSpecificTypeAnalyzer}, Nothing, Nothing, False, Diagnostic(SymbolCouldHaveMoreSpecificTypeAnalyzer.LocalCouldHaveMoreSpecificTypeDescriptor.Id, "a").WithArguments("a", "Middle").WithLocation(3, 13), @@ -730,7 +730,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New SeventeenTestAnalyzer}, Nothing, Nothing, False, Diagnostic(SeventeenTestAnalyzer.SeventeenDescriptor.Id, "17").WithLocation(2, 71), @@ -774,7 +774,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NullArgumentTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NullArgumentTestAnalyzer.NullArgumentsDescriptor.Id, "Nothing").WithLocation(13, 12), @@ -815,7 +815,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedQualifiedNameInInit, "").WithLocation(20, 32)) comp.VerifyAnalyzerDiagnostics({New MemberInitializerTestAnalyzer}, Nothing, Nothing, False, Diagnostic(MemberInitializerTestAnalyzer.DoNotUseFieldInitializerDescriptor.Id, ".Field = 10").WithLocation(14, 34), @@ -864,7 +864,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New AssignmentTestAnalyzer}, Nothing, Nothing, False, Diagnostic(AssignmentTestAnalyzer.DoNotUseMemberAssignmentDescriptor.Id, "f1.Field = 0").WithLocation(22, 9), @@ -907,7 +907,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ArrayInitializerTestAnalyzer()}, Nothing, Nothing, False, Diagnostic(ArrayInitializerTestAnalyzer.DoNotUseLargeListOfArrayInitializersDescriptor.Id, "{1, 2, 3, 4, 5, 6}").WithLocation(11, 34), @@ -952,7 +952,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_ExpectedIdentifier, "").WithLocation(11, 21), Diagnostic(ERRID.ERR_UndefinedType1, "UndefType").WithArguments("UndefType").WithLocation(12, 35), @@ -1071,7 +1071,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(60, 17), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(68, 1), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(74, 22)) @@ -1118,7 +1118,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ExplicitVsImplicitInstanceAnalyzer}, Nothing, Nothing, False, Diagnostic(ExplicitVsImplicitInstanceAnalyzer.ExplicitInstanceDescriptor.Id, "Me").WithLocation(3, 9), @@ -1158,7 +1158,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New MemberReferenceAnalyzer}, Nothing, Nothing, False, Diagnostic(MemberReferenceAnalyzer.HandlerAddedDescriptor.Id, "AddHandler Mumble, New MumbleEventHandler(AddressOf Mumbler)").WithLocation(7, 9), ' Bug: Missing a EventReferenceExpression here https://github.com/dotnet/roslyn/issues/8346 @@ -1206,7 +1206,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ParamsArrayTestAnalyzer}, Nothing, Nothing, False, Diagnostic(ParamsArrayTestAnalyzer.LongParamsDescriptor.Id, "M0(1, 2, 3, 4, 5)").WithLocation(9, 9), @@ -1243,7 +1243,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New EqualsValueTestAnalyzer}, Nothing, Nothing, False, Diagnostic(EqualsValueTestAnalyzer.EqualsValueDescriptor.Id, "= 44").WithLocation(2, 26), @@ -1275,7 +1275,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New OwningSymbolTestAnalyzer}, Nothing, Nothing, False, Diagnostic(OwningSymbolTestAnalyzer.ExpressionDescriptor.Id, "0").WithLocation(8, 28), @@ -1318,7 +1318,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NoneOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NoneOperationTestAnalyzer.NoneOperationDescriptor.Id, "Resume").WithLocation(23, 9)) @@ -1368,7 +1368,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LambdaTestAnalyzer}, Nothing, Nothing, False, Diagnostic(LambdaTestAnalyzer.LambdaExpressionDescriptor.Id, "Sub() @@ -1443,7 +1443,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New StaticMemberTestAnalyzer}, Nothing, Nothing, False, Diagnostic(StaticMemberTestAnalyzer.StaticMemberDescriptor.Id, "AddHandler C.E, AddressOf D.Method").WithLocation(19, 9), @@ -1474,7 +1474,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New LabelOperationsTestAnalyzer}, Nothing, Nothing, False, Diagnostic(LabelOperationsTestAnalyzer.LabelDescriptor.Id, "Wilma:").WithLocation(3, 9), @@ -1530,7 +1530,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New UnaryAndBinaryOperationsTestAnalyzer}, Nothing, Nothing, False, Diagnostic(UnaryAndBinaryOperationsTestAnalyzer.BooleanNotDescriptor.Id, "Not b").WithLocation(33, 13), @@ -1678,7 +1678,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New BinaryOperatorVBTestAnalyzer}, Nothing, Nothing, False, Diagnostic(BinaryOperatorVBTestAnalyzer.BinaryUserDefinedOperatorDescriptor.Id, "x + y").WithArguments("OperatorMethodAdd").WithLocation(109, 13), @@ -1737,7 +1737,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics(Diagnostic(ERRID.ERR_DuplicateProcDef1, "-", New Object() {"Public Shared Operator -(x As B2) As B2"}).WithLocation(8, 28), Diagnostic(ERRID.ERR_TypeMismatch2, "10", New Object() {"Integer", "B2"}).WithLocation(23, 17), Diagnostic(ERRID.ERR_NoMostSpecificOverload2, "-x", New Object() {"-", vbCrLf & " 'Public Shared Operator -(x As B2) As B2': Not most specific." & vbCrLf & " 'Public Shared Operator -(x As B2) As B2': Not most specific."}).WithLocation(25, 13)) @@ -1770,7 +1770,7 @@ End Class ' TODO: array should not be treated as ParamArray argument ' https://github.com/dotnet/roslyn/issues/8570 - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New NullOperationSyntaxTestAnalyzer}, Nothing, Nothing, False, Diagnostic(NullOperationSyntaxTestAnalyzer.ParamsArrayOperationDescriptor.Id, "M0()").WithLocation(6, 9), @@ -1800,7 +1800,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_EndFunctionExpected, "Public Function M1(a As Double, b as C) as Double").WithLocation(2, 5), Diagnostic(ERRID.ERR_InvalidEndSub, "End Sub").WithLocation(4, 5), @@ -1831,7 +1831,7 @@ End Class - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.AssertTheseDiagnostics( - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New ConditionalAccessOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(ConditionalAccessOperationTestAnalyzer.ConditionalAccessOperationDescriptor.Id, "p?.Prop").WithLocation(24, 17), @@ -1960,7 +1960,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_LoopControlMustNotBeProperty, "Moo").WithLocation(38, 13), Diagnostic(ERRID.ERR_LoopControlMustNotBeProperty, "Boo").WithLocation(41, 13), @@ -2025,7 +2025,7 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics( Diagnostic(ERRID.ERR_ExpectedComma, "").WithLocation(6, 39), Diagnostic(ERRID.ERR_ExpectedExpression, "").WithLocation(6, 39), @@ -2102,51 +2102,11 @@ End Module - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) + Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) comp.VerifyDiagnostics() comp.VerifyAnalyzerDiagnostics({New TrueFalseUnaryOperationTestAnalyzer}, Nothing, Nothing, False, Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x").WithLocation(27, 12), Diagnostic(TrueFalseUnaryOperationTestAnalyzer.UnaryTrueDescriptor.Id, "x AndAlso y").WithLocation(33, 12)) End Sub - - - - Public Sub IOperationFeatureFlagVisualBasic() - Dim source = - - - - - - Dim comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New IOperationFeatureFlagTestAnalyzer1}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.IOperationFeatureFlagTestAnalyzer1", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New IOperationFeatureFlagTestAnalyzer2}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.IOperationFeatureFlagTestAnalyzer2", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source) - comp.VerifyAnalyzerDiagnostics({New IOperationFeatureFlagTestAnalyzer3}, Nothing, Nothing, True, - Diagnostic("AD0001").WithArguments("Microsoft.CodeAnalysis.UnitTests.Diagnostics.IOperationFeatureFlagTestAnalyzer3", "System.InvalidOperationException", "Feature 'IOperation' is disabled.").WithLocation(1, 1)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New IOperationFeatureFlagTestAnalyzer1}, Nothing, Nothing, False, - Diagnostic(IOperationFeatureFlagTestAnalyzer1.OperationActionDescriptor.Id, "1").WithArguments("Operation", "Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New IOperationFeatureFlagTestAnalyzer2}, Nothing, Nothing, False, - Diagnostic(IOperationFeatureFlagTestAnalyzer2.OperationActionDescriptor.Id, "1").WithArguments("Operation", "CompilationStart within Analysis").WithLocation(3, 17)) - - comp = CompilationUtils.CreateCompilationWithMscorlibAndVBRuntime(source, parseOptions:=TestOptions.RegularWithIOperationFeature) - comp.VerifyAnalyzerDiagnostics({New IOperationFeatureFlagTestAnalyzer3}, Nothing, Nothing, False, - Diagnostic(IOperationFeatureFlagTestAnalyzer3.GetOperationDescriptor.Id, "1").WithLocation(3, 17)) - End Sub End Class End Namespace diff --git a/src/EditorFeatures/Test/Workspaces/TestWorkspace_Create.cs b/src/EditorFeatures/Test/Workspaces/TestWorkspace_Create.cs index dbcc54c5b72edcbe045e252dc2c9f2cb9211fce3..1790b1a4dd02d4e1a25cf005fd2db448a22c9973 100644 --- a/src/EditorFeatures/Test/Workspaces/TestWorkspace_Create.cs +++ b/src/EditorFeatures/Test/Workspaces/TestWorkspace_Create.cs @@ -30,7 +30,6 @@ public partial class TestWorkspace private const string ReportDiagnosticAttributeName = "ReportDiagnostic"; private const string ParseOptionsElementName = "ParseOptions"; private const string LanguageVersionAttributeName = "LanguageVersion"; - private const string FeaturesAttributeName = "Features"; private const string DocumentationModeAttributeName = "DocumentationMode"; private const string DocumentElementName = "Document"; private const string AnalyzerElementName = "Analyzer"; diff --git a/src/EditorFeatures/Test/Workspaces/TestWorkspace_XmlConsumption.cs b/src/EditorFeatures/Test/Workspaces/TestWorkspace_XmlConsumption.cs index 0a3c0686cd4dae187c1b3944e8821319f559d367..663d2df31e4065f888af55b565584830b7560b8a 100644 --- a/src/EditorFeatures/Test/Workspaces/TestWorkspace_XmlConsumption.cs +++ b/src/EditorFeatures/Test/Workspaces/TestWorkspace_XmlConsumption.cs @@ -350,12 +350,6 @@ private static ParseOptions GetParseOptionsWorker(XElement projectElement, strin parseOptions = parseOptions.WithDocumentationMode(documentationMode.Value); } - var featuresAttribute = projectElement.Attribute(FeaturesAttributeName); - if (featuresAttribute != null) - { - parseOptions = parseOptions.WithFeatures(featuresAttribute.Value.Split(',').Select(f => KeyValuePair.Create(f, "true"))); - } - return parseOptions; } diff --git a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb index 77072a24e2668fa53d1537bc56ee4e7e6fd0977f..4430d7c6a12bc4f2b113a2df5e61dda603466d14 100644 --- a/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb +++ b/src/EditorFeatures/Test2/Diagnostics/DiagnosticServiceTests.vb @@ -412,7 +412,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests Public Sub TestDiagnosticAnalyzerExceptionHandledGracefully() Dim test = - + class Foo { } @@ -513,7 +513,7 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests Public Sub TestOperationAnalyzers() Dim test = - + class Foo { void M() { int x = 0; } }