diff --git a/src/EditorFeatures/CSharpTest/Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj b/src/EditorFeatures/CSharpTest/Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj
index 1b7edb89ceb6038a613e311f6be57c3cc09a7cf2..a1094989de6563f0adb87ba27c2968ac9e7b6d87 100644
--- a/src/EditorFeatures/CSharpTest/Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj
+++ b/src/EditorFeatures/CSharpTest/Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests.csproj
@@ -66,6 +66,7 @@
+
diff --git a/src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs b/src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
index 13e36477e7cfe1d329c476c4732438144344c3b6..1c35b76a86f96ea8d044dd8ebf176425cc8f68a6 100644
--- a/src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
+++ b/src/EditorFeatures/CSharpTest/TypeInferrer/TypeInferrerTests.cs
@@ -21,29 +21,38 @@ public TypeInferrerTests(CSharpTestWorkspaceFixture workspaceFixture) : base(wor
{
}
- protected override async Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, bool useNodeStartPosition)
+ protected override async Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, TestMode mode)
{
var root = await document.GetSyntaxRootAsync();
var node = FindExpressionSyntaxFromSpan(root, textSpan);
var typeInference = document.GetLanguageService();
- var inferredType = useNodeStartPosition
- ? typeInference.InferType(await document.GetSemanticModelForSpanAsync(new TextSpan(node?.SpanStart ?? textSpan.Start, 0), CancellationToken.None), node?.SpanStart ?? textSpan.Start, objectAsDefault: true, cancellationToken: CancellationToken.None)
- : typeInference.InferType(await document.GetSemanticModelForSpanAsync(node?.Span ?? textSpan, CancellationToken.None), node, objectAsDefault: true, cancellationToken: CancellationToken.None);
+ ITypeSymbol inferredType;
+
+ if (mode == TestMode.Position)
+ {
+ int position = node?.SpanStart ?? textSpan.Start;
+ inferredType = typeInference.InferType(await document.GetSemanticModelForSpanAsync(new TextSpan(position, 0), CancellationToken.None), position, objectAsDefault: true, cancellationToken: CancellationToken.None);
+ }
+ else
+ {
+ inferredType = typeInference.InferType(await document.GetSemanticModelForSpanAsync(node?.Span ?? textSpan, CancellationToken.None), node, objectAsDefault: true, cancellationToken: CancellationToken.None);
+ }
+
var typeSyntax = inferredType.GenerateTypeSyntax().NormalizeWhitespace();
Assert.Equal(expectedType, typeSyntax.ToString());
}
- private async Task TestInClassAsync(string text, string expectedType)
+ private async Task TestInClassAsync(string text, string expectedType, TestMode mode)
{
text = @"class C
{
$
}".Replace("$", text);
- await TestAsync(text, expectedType);
+ await TestAsync(text, expectedType, mode);
}
- private async Task TestInMethodAsync(string text, string expectedType, bool testNode = true, bool testPosition = true)
+ private async Task TestInMethodAsync(string text, string expectedType, TestMode mode)
{
text = @"class C
{
@@ -52,7 +61,7 @@ void M()
$
}
}".Replace("$", text);
- await TestAsync(text, expectedType, testNode: testNode, testPosition: testPosition);
+ await TestAsync(text, expectedType, mode);
}
private ExpressionSyntax FindExpressionSyntaxFromSpan(SyntaxNode root, TextSpan textSpan)
@@ -79,73 +88,73 @@ public async Task TestConditional1()
// backwards to infer a type here.
await TestInMethodAsync(
@"var q = [|Goo()|] ? 1 : 2;", "global::System.Boolean",
- testPosition: false);
+ TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConditional2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConditional2(TestMode mode)
{
await TestInMethodAsync(
-@"var q = a ? [|Goo()|] : 2;", "global::System.Int32");
+@"var q = a ? [|Goo()|] : 2;", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConditional3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConditional3(TestMode mode)
{
await TestInMethodAsync(
-@"var q = a ? """" : [|Goo()|];", "global::System.String");
+@"var q = a ? """" : [|Goo()|];", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestVariableDeclarator1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestVariableDeclarator1(TestMode mode)
{
await TestInMethodAsync(
-@"int q = [|Goo()|];", "global::System.Int32");
+@"int q = [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestVariableDeclarator2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestVariableDeclarator2(TestMode mode)
{
await TestInMethodAsync(
-@"var q = [|Goo()|];", "global::System.Object");
+@"var q = [|Goo()|];", "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestVariableDeclaratorNullableReferenceType()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestVariableDeclaratorNullableReferenceType(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
-string? q = [|Goo()|];", "global::System.String?");
+string? q = [|Goo()|];", "global::System.String?", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
public async Task TestCoalesce1()
{
await TestInMethodAsync(
-@"var q = [|Goo()|] ?? 1;", "global::System.Int32?", testPosition: false);
+@"var q = [|Goo()|] ?? 1;", "global::System.Int32?", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCoalesce2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestCoalesce2(TestMode mode)
{
await TestInMethodAsync(
@"bool? b;
-var q = b ?? [|Goo()|];", "global::System.Boolean");
+var q = b ?? [|Goo()|];", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCoalesce3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestCoalesce3(TestMode mode)
{
await TestInMethodAsync(
@"string s;
-var q = s ?? [|Goo()|];", "global::System.String");
+var q = s ?? [|Goo()|];", "global::System.String", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
public async Task TestCoalesce4()
{
await TestInMethodAsync(
-@"var q = [|Goo()|] ?? string.Empty;", "global::System.String", testPosition: false);
+@"var q = [|Goo()|] ?? string.Empty;", "global::System.String", TestMode.Node);
}
// This is skipped for now. This is a case where we know we can unilaterally mark the reference type as nullable, as long as the user has #nullable enable on.
@@ -156,56 +165,56 @@ public async Task TestCoalesceInNullableEnabled()
{
await TestInMethodAsync(
@"#nullable enable
-var q = [|Goo()|] ?? string.Empty;", "global::System.String?", testPosition: false);
+var q = [|Goo()|] ?? string.Empty;", "global::System.String?", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestBinaryExpression1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestBinaryExpression1(TestMode mode)
{
await TestInMethodAsync(
@"string s;
-var q = s + [|Goo()|];", "global::System.String");
+var q = s + [|Goo()|];", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestBinaryExpression2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestBinaryExpression2(TestMode mode)
{
await TestInMethodAsync(
@"var s;
-var q = s || [|Goo()|];", "global::System.Boolean");
+var q = s || [|Goo()|];", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestBinaryOperator1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestBinaryOperator1(TestMode mode)
{
await TestInMethodAsync(
-@"var q = x << [|Goo()|];", "global::System.Int32");
+@"var q = x << [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestBinaryOperator2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestBinaryOperator2(TestMode mode)
{
await TestInMethodAsync(
-@"var q = x >> [|Goo()|];", "global::System.Int32");
+@"var q = x >> [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAssignmentOperator3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAssignmentOperator3(TestMode mode)
{
await TestInMethodAsync(
-@"var q <<= [|Goo()|];", "global::System.Int32");
+@"var q <<= [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAssignmentOperator4()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAssignmentOperator4(TestMode mode)
{
await TestInMethodAsync(
-@"var q >>= [|Goo()|];", "global::System.Int32");
+@"var q >>= [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestOverloadedConditionalLogicalOperatorsInferBool()
+ public async Task TestOverloadedConditionalLogicalOperatorsInferBool(TestMode mode)
{
await TestAsync(
@"using System;
@@ -231,12 +240,12 @@ static void Main(string[] args)
{
var c = new C() && [|Goo()|];
}
-}", "global::System.Boolean");
+}", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestConditionalLogicalOrOperatorAlwaysInfersBool()
+ public async Task TestConditionalLogicalOrOperatorAlwaysInfersBool(TestMode mode)
{
var text = @"using System;
class C
@@ -246,12 +255,12 @@ static void Main(string[] args)
var x = a || [|7|];
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestConditionalLogicalAndOperatorAlwaysInfersBool()
+ public async Task TestConditionalLogicalAndOperatorAlwaysInfersBool(TestMode mode)
{
var text = @"using System;
class C
@@ -261,7 +270,7 @@ static void Main(string[] args)
var x = a && [|7|];
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -276,7 +285,7 @@ static void Main(string[] args)
var x = [|a|] | true;
}
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -291,12 +300,12 @@ static void Main(string[] args)
var x = [|a|] | b | c || d;
}
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalOrOperatorInference3()
+ public async Task TestLogicalOrOperatorInference3(TestMode mode)
{
var text = @"using System;
class C
@@ -306,7 +315,7 @@ static void Main(string[] args)
var x = a | b | [|c|] || d;
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -325,12 +334,12 @@ static object Goo(Program p)
return p;
}
}";
- await TestAsync(text, "Program", testPosition: false);
+ await TestAsync(text, "Program", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalOrOperatorInference5()
+ public async Task TestLogicalOrOperatorInference5(TestMode mode)
{
var text = @"using System;
class C
@@ -344,7 +353,7 @@ static object Goo(bool p)
return p;
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -359,12 +368,12 @@ static void Main(string[] args)
if (([|x|] | y) != 0) {}
}
}";
- await TestAsync(text, "global::System.Int32", testPosition: false);
+ await TestAsync(text, "global::System.Int32", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalOrOperatorInference7()
+ public async Task TestLogicalOrOperatorInference7(TestMode mode)
{
var text = @"using System;
class C
@@ -374,7 +383,7 @@ static void Main(string[] args)
if ([|x|] | y) {}
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -389,7 +398,7 @@ static void Main(string[] args)
var x = [|a|] & true;
}
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -404,12 +413,12 @@ static void Main(string[] args)
var x = [|a|] & b & c && d;
}
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalAndOperatorInference3()
+ public async Task TestLogicalAndOperatorInference3(TestMode mode)
{
var text = @"using System;
class C
@@ -419,7 +428,7 @@ static void Main(string[] args)
var x = a & b & [|c|] && d;
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -438,12 +447,12 @@ static object Goo(Program p)
return p;
}
}";
- await TestAsync(text, "Program", testPosition: false);
+ await TestAsync(text, "Program", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalAndOperatorInference5()
+ public async Task TestLogicalAndOperatorInference5(TestMode mode)
{
var text = @"using System;
class C
@@ -457,7 +466,7 @@ static object Goo(bool p)
return p;
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -472,12 +481,12 @@ static void Main(string[] args)
if (([|x|] & y) != 0) {}
}
}";
- await TestAsync(text, "global::System.Int32", testPosition: false);
+ await TestAsync(text, "global::System.Int32", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalAndOperatorInference7()
+ public async Task TestLogicalAndOperatorInference7(TestMode mode)
{
var text = @"using System;
class C
@@ -487,7 +496,7 @@ static void Main(string[] args)
if ([|x|] & y) {}
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -502,7 +511,7 @@ static void Main(string[] args)
var x = [|a|] ^ true;
}
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -517,12 +526,12 @@ static void Main(string[] args)
var x = [|a|] ^ b ^ c && d;
}
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalXorOperatorInference3()
+ public async Task TestLogicalXorOperatorInference3(TestMode mode)
{
var text = @"using System;
class C
@@ -532,7 +541,7 @@ static void Main(string[] args)
var x = a ^ b ^ [|c|] && d;
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -551,12 +560,12 @@ static object Goo(Program p)
return p;
}
}";
- await TestAsync(text, "Program", testPosition: false);
+ await TestAsync(text, "Program", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalXorOperatorInference5()
+ public async Task TestLogicalXorOperatorInference5(TestMode mode)
{
var text = @"using System;
class C
@@ -570,7 +579,7 @@ static object Goo(bool p)
return p;
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -585,12 +594,12 @@ static void Main(string[] args)
if (([|x|] ^ y) != 0) {}
}
}";
- await TestAsync(text, "global::System.Int32", testPosition: false);
+ await TestAsync(text, "global::System.Int32", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalXorOperatorInference7()
+ public async Task TestLogicalXorOperatorInference7(TestMode mode)
{
var text = @"using System;
class C
@@ -600,12 +609,12 @@ static void Main(string[] args)
if ([|x|] ^ y) {}
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalOrEqualsOperatorInference1()
+ public async Task TestLogicalOrEqualsOperatorInference1(TestMode mode)
{
var text = @"using System;
class C
@@ -615,12 +624,12 @@ static void Main(string[] args)
if ([|x|] |= y) {}
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalOrEqualsOperatorInference2()
+ public async Task TestLogicalOrEqualsOperatorInference2(TestMode mode)
{
var text = @"using System;
class C
@@ -630,12 +639,12 @@ static void Main(string[] args)
int z = [|x|] |= y;
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalAndEqualsOperatorInference1()
+ public async Task TestLogicalAndEqualsOperatorInference1(TestMode mode)
{
var text = @"using System;
class C
@@ -645,12 +654,12 @@ static void Main(string[] args)
if ([|x|] &= y) {}
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalAndEqualsOperatorInference2()
+ public async Task TestLogicalAndEqualsOperatorInference2(TestMode mode)
{
var text = @"using System;
class C
@@ -660,12 +669,12 @@ static void Main(string[] args)
int z = [|x|] &= y;
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalXorEqualsOperatorInference1()
+ public async Task TestLogicalXorEqualsOperatorInference1(TestMode mode)
{
var text = @"using System;
class C
@@ -675,12 +684,12 @@ static void Main(string[] args)
if ([|x|] ^= y) {}
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617633, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617633")]
- public async Task TestLogicalXorEqualsOperatorInference2()
+ public async Task TestLogicalXorEqualsOperatorInference2(TestMode mode)
{
var text = @"using System;
class C
@@ -690,122 +699,122 @@ static void Main(string[] args)
int z = [|x|] ^= y;
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInConstructor()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInConstructor(TestMode mode)
{
await TestInClassAsync(
@"C()
{
return [|Goo()|];
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInDestructor()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInDestructor(TestMode mode)
{
await TestInClassAsync(
@"~C()
{
return [|Goo()|];
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInMethod(TestMode mode)
{
await TestInClassAsync(
@"int M()
{
return [|Goo()|];
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInMethodNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInMethodNullableReference(TestMode mode)
{
await TestInClassAsync(
@"#nullable enable
string? M()
{
return [|Goo()|];
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInVoidMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInVoidMethod(TestMode mode)
{
await TestInClassAsync(
@"void M()
{
return [|Goo()|];
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTMethod(TestMode mode)
{
await TestInClassAsync(
@"async System.Threading.Tasks.Task M()
{
return [|Goo()|];
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTMethodNestedNullability()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTMethodNestedNullability(TestMode mode)
{
await TestInClassAsync(
@"async System.Threading.Tasks.Task M()
{
return [|Goo()|];
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskMethod(TestMode mode)
{
await TestInClassAsync(
@"async System.Threading.Tasks.Task M()
{
return [|Goo()|];
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncVoidMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncVoidMethod(TestMode mode)
{
await TestInClassAsync(
@"async void M()
{
return [|Goo()|];
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInOperator()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInOperator(TestMode mode)
{
await TestInClassAsync(
@"public static C operator ++(C c)
{
return [|Goo()|];
-}", "global::C");
+}", "global::C", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInConversionOperator()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInConversionOperator(TestMode mode)
{
await TestInClassAsync(
@"public static implicit operator int(C c)
{
return [|Goo()|];
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInPropertyGetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInPropertyGetter(TestMode mode)
{
await TestInClassAsync(
@"int P
@@ -814,11 +823,11 @@ public async Task TestReturnInPropertyGetter()
{
return [|Goo()|];
}
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInPropertyGetterNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInPropertyGetterNullableReference(TestMode mode)
{
await TestInClassAsync(
@"#nullable enable
@@ -828,11 +837,11 @@ public async Task TestReturnInPropertyGetterNullableReference()
{
return [|Goo()|];
}
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInPropertySetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInPropertySetter(TestMode mode)
{
await TestInClassAsync(
@"int P
@@ -841,11 +850,11 @@ public async Task TestReturnInPropertySetter()
{
return [|Goo()|];
}
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInIndexerGetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInIndexerGetter(TestMode mode)
{
await TestInClassAsync(
@"int this[int i]
@@ -854,11 +863,11 @@ public async Task TestReturnInIndexerGetter()
{
return [|Goo()|];
}
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInIndexerGetterNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInIndexerGetterNullableReference(TestMode mode)
{
await TestInClassAsync(
@"#nullable enable
@@ -868,11 +877,11 @@ public async Task TestReturnInIndexerGetterNullableReference()
{
return [|Goo()|];
}
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInIndexerSetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInIndexerSetter(TestMode mode)
{
await TestInClassAsync(
@"int this[int i]
@@ -881,11 +890,11 @@ public async Task TestReturnInIndexerSetter()
{
return [|Goo()|];
}
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInEventAdder()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInEventAdder(TestMode mode)
{
await TestInClassAsync(
@"event System.EventHandler E
@@ -895,11 +904,11 @@ public async Task TestReturnInEventAdder()
return [|Goo()|];
}
remove { }
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInEventRemover()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInEventRemover(TestMode mode)
{
await TestInClassAsync(
@"event System.EventHandler E
@@ -909,11 +918,11 @@ public async Task TestReturnInEventRemover()
{
return [|Goo()|];
}
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -922,11 +931,11 @@ int F()
{
return [|Goo()|];
}
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInLocalFunctionNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInLocalFunctionNullableReference(TestMode mode)
{
await TestInClassAsync(
@"#nullable enable
@@ -936,11 +945,11 @@ void M()
{
return [|Goo()|];
}
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -949,11 +958,11 @@ async System.Threading.Tasks.Task F()
{
return [|Goo()|];
}
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -962,11 +971,11 @@ async System.Threading.Tasks.Task F()
{
return [|Goo()|];
}
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncVoidLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncVoidLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -975,187 +984,184 @@ async void F()
{
return [|Goo()|];
}
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedConstructor()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedConstructor(TestMode mode)
{
await TestInClassAsync(
-@"C() => [|Goo()|];", "void");
+@"C() => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedDestructor()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedDestructor(TestMode mode)
{
await TestInClassAsync(
-@"~C() => [|Goo()|];", "void");
+@"~C() => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedMethod(TestMode mode)
{
await TestInClassAsync(
-@"int M() => [|Goo()|];", "global::System.Int32");
+@"int M() => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedVoidMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedVoidMethod(TestMode mode)
{
await TestInClassAsync(
-@"void M() => [|Goo()|];", "void");
+@"void M() => [|Goo()|];", "void", mode);
}
[WorkItem(27647, "https://github.com/dotnet/roslyn/issues/27647")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncTaskOfTMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncTaskOfTMethod(TestMode mode)
{
await TestInClassAsync(
-@"async System.Threading.Tasks.Task M() => [|Goo()|];", "global::System.Int32");
+@"async System.Threading.Tasks.Task M() => [|Goo()|];", "global::System.Int32", mode);
}
[WorkItem(27647, "https://github.com/dotnet/roslyn/issues/27647")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncTaskOfTMethodNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncTaskOfTMethodNullableReference(TestMode mode)
{
await TestInClassAsync(
@"#nullable enable
-async System.Threading.Tasks.Task M() => [|Goo()|];", "global::System.String?");
+async System.Threading.Tasks.Task M() => [|Goo()|];", "global::System.String?", mode);
}
[WorkItem(27647, "https://github.com/dotnet/roslyn/issues/27647")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncTaskMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncTaskMethod(TestMode mode)
{
await TestInClassAsync(
-@"async System.Threading.Tasks.Task M() => [|Goo()|];", "void");
+@"async System.Threading.Tasks.Task M() => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncVoidMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncVoidMethod(TestMode mode)
{
await TestInClassAsync(
-@"async void M() => [|Goo()|];", "void");
+@"async void M() => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedOperator()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedOperator(TestMode mode)
{
await TestInClassAsync(
-@"public static C operator ++(C c) => [|Goo()|];", "global::C");
+@"public static C operator ++(C c) => [|Goo()|];", "global::C", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedConversionOperator()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedConversionOperator(TestMode mode)
{
await TestInClassAsync(
-@"public static implicit operator int(C c) => [|Goo()|];", "global::System.Int32");
+@"public static implicit operator int(C c) => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedProperty()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedProperty(TestMode mode)
{
await TestInClassAsync(
-@"int P => [|Goo()|];", "global::System.Int32");
+@"int P => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedIndexer()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedIndexer(TestMode mode)
{
await TestInClassAsync(
-@"int this[int i] => [|Goo()|];", "global::System.Int32");
+@"int this[int i] => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedPropertyGetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedPropertyGetter(TestMode mode)
{
await TestInClassAsync(
-@"int P { get => [|Goo()|]; }", "global::System.Int32");
+@"int P { get => [|Goo()|]; }", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedPropertySetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedPropertySetter(TestMode mode)
{
await TestInClassAsync(
-@"int P { set => [|Goo()|]; }", "void");
+@"int P { set => [|Goo()|]; }", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedIndexerGetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedIndexerGetter(TestMode mode)
{
await TestInClassAsync(
-@"int this[int i] { get => [|Goo()|]; }", "global::System.Int32");
+@"int this[int i] { get => [|Goo()|]; }", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedIndexerSetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedIndexerSetter(TestMode mode)
{
await TestInClassAsync(
-@"int this[int i] { set => [|Goo()|]; }", "void");
+@"int this[int i] { set => [|Goo()|]; }", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedEventAdder()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedEventAdder(TestMode mode)
{
await TestInClassAsync(
-@"event System.EventHandler E { add => [|Goo()|]; remove { } }", "void");
+@"event System.EventHandler E { add => [|Goo()|]; remove { } }", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedEventRemover()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedEventRemover(TestMode mode)
{
await TestInClassAsync(
-@"event System.EventHandler E { add { } remove => [|Goo()|]; }", "void");
+@"event System.EventHandler E { add { } remove => [|Goo()|]; }", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
{
int F() => [|Goo()|];
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
[WorkItem(27647, "https://github.com/dotnet/roslyn/issues/27647")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncTaskOfTLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncTaskOfTLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
{
async System.Threading.Tasks.Task F() => [|Goo()|];
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
[WorkItem(27647, "https://github.com/dotnet/roslyn/issues/27647")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncTaskLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncTaskLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
{
async System.Threading.Tasks.Task F() => [|Goo()|];
-}", "void");
+}", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionBodiedAsyncVoidLocalFunction()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionBodiedAsyncVoidLocalFunction(TestMode mode)
{
await TestInClassAsync(
@"void M()
{
async void F() => [|Goo()|];
-}", "void");
+}", "void", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(827897, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/827897")]
- [Theory, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- [InlineData("IEnumerable")]
- [InlineData("IEnumerator")]
- [InlineData("InvalidGenericType")]
- public async Task TestYieldReturnInMethod(string returnTypeName)
+ public async Task TestYieldReturnInMethod([CombinatorialValues("IEnumerable", "IEnumerator", "InvalidGenericType")] string returnTypeName, TestMode mode)
{
var markup =
$@"using System.Collections.Generic;
@@ -1167,14 +1173,11 @@ class C
yield return [|abc|]
}}
}}";
- await TestAsync(markup, "global::System.Int32");
+ await TestAsync(markup, "global::System.Int32", mode);
}
- [Theory, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- [InlineData("IEnumerable")]
- [InlineData("IEnumerator")]
- [InlineData("InvalidGenericType")]
- public async Task TestYieldReturnInMethodNullableReference(string returnTypeName)
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestYieldReturnInMethodNullableReference([CombinatorialValues("IEnumerable", "IEnumerator", "InvalidGenericType")] string returnTypeName, TestMode mode)
{
var markup =
$@"#nullable enable
@@ -1187,14 +1190,11 @@ class C
yield return [|abc|]
}}
}}";
- await TestAsync(markup, "global::System.String?");
+ await TestAsync(markup, "global::System.String?", mode);
}
- [Theory, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- [InlineData("IAsyncEnumerable")]
- [InlineData("IAsyncEnumerator")]
- [InlineData("InvalidGenericType")]
- public async Task TestYieldReturnInAsyncMethod(string returnTypeName)
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestYieldReturnInAsyncMethod([CombinatorialValues("IAsyncEnumerable", "IAsyncEnumerator", "InvalidGenericType")] string returnTypeName, TestMode mode)
{
var markup =
$@"namespace System.Collections.Generic
@@ -1208,14 +1208,11 @@ class C
}}
}}
}}";
- await TestAsync(markup, "global::System.Int32");
+ await TestAsync(markup, "global::System.Int32", mode);
}
- [Theory, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- [InlineData("int[]")]
- [InlineData("InvalidNonGenericType")]
- [InlineData("InvalidGenericType")]
- public async Task TestYieldReturnInvalidTypeInMethod(string returnType)
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestYieldReturnInvalidTypeInMethod([CombinatorialValues("int[]", "InvalidNonGenericType", "InvalidGenericType")] string returnType, TestMode mode)
{
var markup =
$@"class C
@@ -1225,12 +1222,12 @@ public async Task TestYieldReturnInvalidTypeInMethod(string returnType)
yield return [|abc|]
}}
}}";
- await TestAsync(markup, "global::System.Object");
+ await TestAsync(markup, "global::System.Object", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(30235, "https://github.com/dotnet/roslyn/issues/30235")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestYieldReturnInLocalFunction()
+ public async Task TestYieldReturnInLocalFunction(TestMode mode)
{
var markup =
@"using System.Collections.Generic;
@@ -1245,11 +1242,11 @@ IEnumerable F()
}
}
}";
- await TestAsync(markup, "global::System.Int32");
+ await TestAsync(markup, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestYieldReturnInPropertyGetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestYieldReturnInPropertyGetter(TestMode mode)
{
var markup =
@"using System.Collections.Generic;
@@ -1264,11 +1261,11 @@ IEnumerable P
}
}
}";
- await TestAsync(markup, "global::System.Int32");
+ await TestAsync(markup, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestYieldReturnInPropertySetter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestYieldReturnInPropertySetter(TestMode mode)
{
var markup =
@"using System.Collections.Generic;
@@ -1283,423 +1280,423 @@ IEnumerable P
}
}
}";
- await TestAsync(markup, "global::System.Object");
+ await TestAsync(markup, "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestYieldReturnAsGlobalStatement()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestYieldReturnAsGlobalStatement(TestMode mode)
{
await TestAsync(
-@"yield return [|abc|]", "global::System.Object", sourceCodeKind: SourceCodeKind.Script);
+@"yield return [|abc|]", "global::System.Object", mode, sourceCodeKind: SourceCodeKind.Script);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Func f = s =>
{
return [|Goo()|];
-};", "global::System.Int32");
+};", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Func f = () =>
{
return [|Goo()|];
-};", "global::System.Int32");
+};", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInLambdaWithNullableReturn()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInLambdaWithNullableReturn(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
System.Func f = s =>
{
return [|Goo()|];
-};", "global::System.String?");
+};", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAnonymousMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAnonymousMethod(TestMode mode)
{
await TestInMethodAsync(
@"System.Func f = delegate ()
{
return [|Goo()|];
-};", "global::System.Int32");
+};", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAnonymousMethodWithNullableReturn()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAnonymousMethodWithNullableReturn(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
System.Func f = delegate ()
{
return [|Goo()|];
-};", "global::System.String?");
+};", "global::System.String?", mode);
}
[WorkItem(4486, "https://github.com/dotnet/roslyn/issues/4486")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Func> f = async s =>
{
return [|Goo()|];
-};", "global::System.Int32");
+};", "global::System.Int32", mode);
}
[WorkItem(4486, "https://github.com/dotnet/roslyn/issues/4486")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Func> f = async () =>
{
return [|Goo()|];
-};", "global::System.Int32");
+};", "global::System.Int32", mode);
}
[WorkItem(4486, "https://github.com/dotnet/roslyn/issues/4486")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTAnonymousMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTAnonymousMethod(TestMode mode)
{
await TestInMethodAsync(
@"System.Func> f = async delegate ()
{
return [|Goo()|];
-};", "global::System.Int32");
+};", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskOfTAnonymousMethodWithNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskOfTAnonymousMethodWithNullableReference(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
System.Func> f = async delegate ()
{
return [|Goo()|];
-};", "global::System.String?");
+};", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Func f = async s =>
{
return [|Goo()|];
-};", "void");
+};", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Func f = async () =>
{
return [|Goo()|];
-};", "void");
+};", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncTaskAnonymousMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncTaskAnonymousMethod(TestMode mode)
{
await TestInMethodAsync(
@"System.Func f = async delegate ()
{
return [|Goo()|];
-};", "void");
+};", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncVoidSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncVoidSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Action f = async s =>
{
return [|Goo()|];
-};", "void");
+};", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncVoidParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncVoidParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
@"System.Action f = async () =>
{
return [|Goo()|];
-};", "void");
+};", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnInAsyncVoidAnonymousMethod()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnInAsyncVoidAnonymousMethod(TestMode mode)
{
await TestInMethodAsync(
@"System.Action f = async delegate ()
{
return [|Goo()|];
-};", "void");
+};", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestReturnAsGlobalStatement()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestReturnAsGlobalStatement(TestMode mode)
{
await TestAsync(
-@"return [|Goo()|];", "global::System.Object", sourceCodeKind: SourceCodeKind.Script);
+@"return [|Goo()|];", "global::System.Object", mode, sourceCodeKind: SourceCodeKind.Script);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Func f = s => [|Goo()|];", "global::System.Int32");
+@"System.Func f = s => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Func f = () => [|Goo()|];", "global::System.Int32");
+@"System.Func f = () => [|Goo()|];", "global::System.Int32", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(30232, "https://github.com/dotnet/roslyn/issues/30232")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncTaskOfTSimpleLambda()
+ public async Task TestAsyncTaskOfTSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Func> f = async s => [|Goo()|];", "global::System.Int32");
+@"System.Func> f = async s => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncTaskOfTSimpleLambdaWithNullableReturn()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAsyncTaskOfTSimpleLambdaWithNullableReturn(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
-System.Func> f = async s => [|Goo()|];", "global::System.String?");
+System.Func> f = async s => [|Goo()|];", "global::System.String?", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(30232, "https://github.com/dotnet/roslyn/issues/30232")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncTaskOfTParenthesizedLambda()
+ public async Task TestAsyncTaskOfTParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Func> f = async () => [|Goo()|];", "global::System.Int32");
+@"System.Func> f = async () => [|Goo()|];", "global::System.Int32", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(30232, "https://github.com/dotnet/roslyn/issues/30232")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncTaskSimpleLambda()
+ public async Task TestAsyncTaskSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Func f = async s => [|Goo()|];", "void");
+@"System.Func f = async s => [|Goo()|];", "void", mode);
}
[WorkItem(30232, "https://github.com/dotnet/roslyn/issues/30232")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncTaskParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAsyncTaskParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Func f = async () => [|Goo()|];", "void");
+@"System.Func f = async () => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncVoidSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAsyncVoidSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Action f = async s => [|Goo()|];", "void");
+@"System.Action f = async s => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAsyncVoidParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAsyncVoidParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Action f = async () => [|Goo()|];", "void");
+@"System.Action f = async () => [|Goo()|];", "void", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionTreeSimpleLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionTreeSimpleLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Linq.Expressions.Expression> f = s => [|Goo()|];", "global::System.Int32");
+@"System.Linq.Expressions.Expression> f = s => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestExpressionTreeParenthesizedLambda()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestExpressionTreeParenthesizedLambda(TestMode mode)
{
await TestInMethodAsync(
-@"System.Linq.Expressions.Expression> f = () => [|Goo()|];", "global::System.Int32");
+@"System.Linq.Expressions.Expression> f = () => [|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestThrow()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestThrow(TestMode mode)
{
await TestInMethodAsync(
-@"throw [|Goo()|];", "global::System.Exception");
+@"throw [|Goo()|];", "global::System.Exception", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCatch()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestCatch(TestMode mode)
{
- await TestInMethodAsync("try { } catch ([|Goo|] ex) { }", "global::System.Exception");
+ await TestInMethodAsync("try { } catch ([|Goo|] ex) { }", "global::System.Exception", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestIf()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestIf(TestMode mode)
{
- await TestInMethodAsync(@"if ([|Goo()|]) { }", "global::System.Boolean");
+ await TestInMethodAsync(@"if ([|Goo()|]) { }", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestWhile()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestWhile(TestMode mode)
{
- await TestInMethodAsync(@"while ([|Goo()|]) { }", "global::System.Boolean");
+ await TestInMethodAsync(@"while ([|Goo()|]) { }", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestDo()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestDo(TestMode mode)
{
- await TestInMethodAsync(@"do { } while ([|Goo()|])", "global::System.Boolean");
+ await TestInMethodAsync(@"do { } while ([|Goo()|])", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestFor1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestFor1(TestMode mode)
{
await TestInMethodAsync(
@"for (int i = 0; [|Goo()|];
-i++) { }", "global::System.Boolean");
+i++) { }", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestFor2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestFor2(TestMode mode)
{
- await TestInMethodAsync(@"for (string i = [|Goo()|]; ; ) { }", "global::System.String");
+ await TestInMethodAsync(@"for (string i = [|Goo()|]; ; ) { }", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestFor3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestFor3(TestMode mode)
{
- await TestInMethodAsync(@"for (var i = [|Goo()|]; ; ) { }", "global::System.Int32");
+ await TestInMethodAsync(@"for (var i = [|Goo()|]; ; ) { }", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestForNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestForNullableReference(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
-for (string? s = [|Goo()|]; ; ) { }", "global::System.String?");
+for (string? s = [|Goo()|]; ; ) { }", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestUsing1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestUsing1(TestMode mode)
{
- await TestInMethodAsync(@"using ([|Goo()|]) { }", "global::System.IDisposable");
+ await TestInMethodAsync(@"using ([|Goo()|]) { }", "global::System.IDisposable", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestUsing2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestUsing2(TestMode mode)
{
- await TestInMethodAsync(@"using (int i = [|Goo()|]) { }", "global::System.Int32");
+ await TestInMethodAsync(@"using (int i = [|Goo()|]) { }", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestUsing3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestUsing3(TestMode mode)
{
- await TestInMethodAsync(@"using (var v = [|Goo()|]) { }", "global::System.IDisposable");
+ await TestInMethodAsync(@"using (var v = [|Goo()|]) { }", "global::System.IDisposable", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestForEach()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestForEach(TestMode mode)
{
- await TestInMethodAsync(@"foreach (int v in [|Goo()|]) { }", "global::System.Collections.Generic.IEnumerable");
+ await TestInMethodAsync(@"foreach (int v in [|Goo()|]) { }", "global::System.Collections.Generic.IEnumerable", mode);
}
- [Fact(Skip = "https://github.com/dotnet/roslyn/issues/37309"), Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestForEachNullableElements()
+ [Theory(Skip = "https://github.com/dotnet/roslyn/issues/37309"), CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestForEachNullableElements(TestMode mode)
{
await TestInMethodAsync(
@"#nullable enable
-foreach (string? v in [|Goo()|]) { }", "global::System.Collections.Generic.IEnumerable");
+foreach (string? v in [|Goo()|]) { }", "global::System.Collections.Generic.IEnumerable", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestPrefixExpression1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestPrefixExpression1(TestMode mode)
{
await TestInMethodAsync(
-@"var q = +[|Goo()|];", "global::System.Int32");
+@"var q = +[|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestPrefixExpression2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestPrefixExpression2(TestMode mode)
{
await TestInMethodAsync(
-@"var q = -[|Goo()|];", "global::System.Int32");
+@"var q = -[|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestPrefixExpression3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestPrefixExpression3(TestMode mode)
{
await TestInMethodAsync(
-@"var q = ~[|Goo()|];", "global::System.Int32");
+@"var q = ~[|Goo()|];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestPrefixExpression4()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestPrefixExpression4(TestMode mode)
{
await TestInMethodAsync(
-@"var q = ![|Goo()|];", "global::System.Boolean");
+@"var q = ![|Goo()|];", "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestPrefixExpression5()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestPrefixExpression5(TestMode mode)
{
await TestInMethodAsync(
-@"var q = System.DayOfWeek.Monday & ~[|Goo()|];", "global::System.DayOfWeek");
+@"var q = System.DayOfWeek.Monday & ~[|Goo()|];", "global::System.DayOfWeek", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestArrayRankSpecifier()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayRankSpecifier(TestMode mode)
{
await TestInMethodAsync(
-@"var q = new string[[|Goo()|]];", "global::System.Int32");
+@"var q = new string[[|Goo()|]];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestSwitch1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestSwitch1(TestMode mode)
{
- await TestInMethodAsync(@"switch ([|Goo()|]) { }", "global::System.Int32");
+ await TestInMethodAsync(@"switch ([|Goo()|]) { }", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestSwitch2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestSwitch2(TestMode mode)
{
- await TestInMethodAsync(@"switch ([|Goo()|]) { default: }", "global::System.Int32");
+ await TestInMethodAsync(@"switch ([|Goo()|]) { default: }", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestSwitch3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestSwitch3(TestMode mode)
{
- await TestInMethodAsync(@"switch ([|Goo()|]) { case ""a"": }", "global::System.String");
+ await TestInMethodAsync(@"switch ([|Goo()|]) { case ""a"": }", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestMethodCall1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestMethodCall1(TestMode mode)
{
await TestInMethodAsync(
-@"Bar([|Goo()|]);", "global::System.Object");
+@"Bar([|Goo()|]);", "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestMethodCall2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestMethodCall2(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1707,11 +1704,11 @@ public async Task TestMethodCall2()
Bar([|Goo()|]);
}
-void Bar(int i);", "global::System.Int32");
+void Bar(int i);", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestMethodCall3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestMethodCall3(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1719,11 +1716,11 @@ public async Task TestMethodCall3()
Bar([|Goo()|]);
}
-void Bar();", "global::System.Object");
+void Bar();", "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestMethodCall4()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestMethodCall4(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1731,11 +1728,11 @@ public async Task TestMethodCall4()
Bar([|Goo()|]);
}
-void Bar(int i, string s);", "global::System.Int32");
+void Bar(int i, string s);", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestMethodCall5()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestMethodCall5(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1743,11 +1740,11 @@ public async Task TestMethodCall5()
Bar(s: [|Goo()|]);
}
-void Bar(int i, string s);", "global::System.String");
+void Bar(int i, string s);", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestMethodCallNullableReference()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestMethodCallNullableReference(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1755,18 +1752,18 @@ public async Task TestMethodCallNullableReference()
Bar([|Goo()|]);
}
-void Bar(string? s);", "global::System.String?");
+void Bar(string? s);", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConstructorCall1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConstructorCall1(TestMode mode)
{
await TestInMethodAsync(
-@"new C([|Goo()|]);", "global::System.Object");
+@"new C([|Goo()|]);", "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConstructorCall2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConstructorCall2(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1776,11 +1773,11 @@ public async Task TestConstructorCall2()
C(int i)
{
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConstructorCall3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConstructorCall3(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1790,11 +1787,11 @@ public async Task TestConstructorCall3()
C()
{
-}", "global::System.Object");
+}", "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConstructorCall4()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConstructorCall4(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1804,11 +1801,11 @@ public async Task TestConstructorCall4()
C(int i, string s)
{
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConstructorCall5()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConstructorCall5(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1818,11 +1815,11 @@ public async Task TestConstructorCall5()
C(int i, string s)
{
-}", "global::System.String");
+}", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestConstructorCallNullableParameter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestConstructorCallNullableParameter(TestMode mode)
{
await TestInClassAsync(
@"#nullable enable
@@ -1834,12 +1831,12 @@ void M()
C(string? s)
{
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
[WorkItem(858112, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/858112")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestThisConstructorInitializer1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestThisConstructorInitializer1(TestMode mode)
{
await TestAsync(
@"class MyClass
@@ -1847,12 +1844,12 @@ public async Task TestThisConstructorInitializer1()
public MyClass(int x) : this([|test|])
{
}
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
[WorkItem(858112, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/858112")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestThisConstructorInitializer2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestThisConstructorInitializer2(TestMode mode)
{
await TestAsync(
@"class MyClass
@@ -1860,11 +1857,11 @@ public async Task TestThisConstructorInitializer2()
public MyClass(int x, string y) : this(5, [|test|])
{
}
-}", "global::System.String");
+}", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestThisConstructorInitializerNullableParameter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestThisConstructorInitializerNullableParameter(TestMode mode)
{
await TestAsync(
@"#nullable enable
@@ -1874,12 +1871,12 @@ class MyClass
public MyClass(string? y) : this([|test|])
{
}
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
[WorkItem(858112, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/858112")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestBaseConstructorInitializer()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestBaseConstructorInitializer(TestMode mode)
{
await TestAsync(
@"class B
@@ -1894,11 +1891,11 @@ class D : B
public D() : base([|test|])
{
}
-}", "global::System.Int32");
+}", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestBaseConstructorInitializerNullableParameter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestBaseConstructorInitializerNullableParameter(TestMode mode)
{
await TestAsync(
@"#nullable enable
@@ -1915,26 +1912,26 @@ class D : B
public D() : base([|test|])
{
}
-}", "global::System.String?");
+}", "global::System.String?", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestIndexAccess1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestIndexAccess1(TestMode mode)
{
await TestInMethodAsync(
@"string[] i;
-i[[|Goo()|]];", "global::System.Int32");
+i[[|Goo()|]];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestIndexerCall1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestIndexerCall1(TestMode mode)
{
- await TestInMethodAsync(@"this[[|Goo()|]];", "global::System.Int32");
+ await TestInMethodAsync(@"this[[|Goo()|]];", "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestIndexerCall2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestIndexerCall2(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1942,11 +1939,11 @@ public async Task TestIndexerCall2()
this[[|Goo()|]];
}
-int this[long i] { get; }", "global::System.Int64");
+int this[long i] { get; }", "global::System.Int64", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestIndexerCall3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestIndexerCall3(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1954,11 +1951,11 @@ public async Task TestIndexerCall3()
this[42, [|Goo()|]];
}
-int this[int i, string s] { get; }", "global::System.String");
+int this[int i, string s] { get; }", "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestIndexerCall5()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestIndexerCall5(TestMode mode)
{
await TestInClassAsync(
@"void M()
@@ -1966,11 +1963,11 @@ public async Task TestIndexerCall5()
this[s: [|Goo()|]];
}
-int this[int i, string s] { get; }", "global::System.String");
+int this[int i, string s] { get; }", "global::System.String", mode);
}
- [Fact]
- public async Task TestArrayInitializerInImplicitArrayCreationSimple()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInImplicitArrayCreationSimple(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -1983,11 +1980,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
- public async Task TestArrayInitializerInImplicitArrayCreation1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInImplicitArrayCreation1(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2003,11 +2000,11 @@ void M()
int Goo() { return 2; }
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
- public async Task TestArrayInitializerInImplicitArrayCreation2()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInImplicitArrayCreation2(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2022,11 +2019,11 @@ void M()
int Bar() { return 1; }
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
- public async Task TestArrayInitializerInImplicitArrayCreation3()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInImplicitArrayCreation3(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2039,11 +2036,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.Object");
+ await TestAsync(text, "global::System.Object", mode);
}
- [Fact]
- public async Task TestArrayInitializerInImplicitArrayCreationInferredAsNullable()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInImplicitArrayCreationInferredAsNullable(TestMode mode)
{
var text =
@"#nullable enable
@@ -2060,11 +2057,11 @@ void M()
object? Bar() { return null; }
}";
- await TestAsync(text, "global::System.Object?");
+ await TestAsync(text, "global::System.Object?", mode);
}
- [Fact]
- public async Task TestArrayInitializerInEqualsValueClauseSimple()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInEqualsValueClauseSimple(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2077,11 +2074,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
- public async Task TestArrayInitializerInEqualsValueClause()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInEqualsValueClause(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2096,11 +2093,11 @@ void M()
int Bar() { return 1; }
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
- public async Task TestArrayInitializerInEqualsValueClauseNullableElement()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInitializerInEqualsValueClauseNullableElement(TestMode mode)
{
var text =
@"#nullable enable
@@ -2115,13 +2112,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.String?");
+ await TestAsync(text, "global::System.String?", mode);
}
- [Fact]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCollectionInitializer1()
+ public async Task TestCollectionInitializer1(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2134,12 +2130,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCollectionInitializerNullableElement()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestCollectionInitializerNullableElement(TestMode mode)
{
var text =
@"#nullable enable
@@ -2154,13 +2149,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.String?");
+ await TestAsync(text, "global::System.String?", mode);
}
- [Fact]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCollectionInitializer2()
+ public async Task TestCollectionInitializer2(TestMode mode)
{
var text =
@"
@@ -2174,13 +2168,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCollectionInitializer3()
+ public async Task TestCollectionInitializer3(TestMode mode)
{
var text =
@"
@@ -2194,12 +2187,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.String");
+ await TestAsync(text, "global::System.String", mode);
}
- [Fact]
+ [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
public async Task TestCustomCollectionInitializerAddMethod1()
{
var text =
@@ -2219,13 +2211,12 @@ public System.Collections.IEnumerator GetEnumerator()
}
}";
- await TestAsync(text, "global::System.Int32", testPosition: false);
+ await TestAsync(text, "global::System.Int32", TestMode.Node);
}
- [Fact]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCustomCollectionInitializerAddMethod2()
+ public async Task TestCustomCollectionInitializerAddMethod2(TestMode mode)
{
var text =
@"class C : System.Collections.IEnumerable
@@ -2244,13 +2235,12 @@ public System.Collections.IEnumerator GetEnumerator()
}
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(529480, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529480")]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCustomCollectionInitializerAddMethod3()
+ public async Task TestCustomCollectionInitializerAddMethod3(TestMode mode)
{
var text =
@"class C : System.Collections.IEnumerable
@@ -2269,12 +2259,11 @@ public System.Collections.IEnumerator GetEnumerator()
}
}";
- await TestAsync(text, "global::System.String");
+ await TestAsync(text, "global::System.String", mode);
}
- [Fact]
- [Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestCustomCollectionInitializerAddMethodWithNullableParameter()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestCustomCollectionInitializerAddMethodWithNullableParameter(TestMode mode)
{
var text =
@"class C : System.Collections.IEnumerable
@@ -2293,7 +2282,7 @@ public System.Collections.IEnumerator GetEnumerator()
}
}";
- await TestAsync(text, "global::System.String?");
+ await TestAsync(text, "global::System.String?", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2309,7 +2298,7 @@ void Goo()
}
}";
- await TestAsync(text, "global::A", testPosition: false);
+ await TestAsync(text, "global::A", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2325,7 +2314,7 @@ void Goo()
}
}";
- await TestAsync(text, "global::A[]", testNode: false);
+ await TestAsync(text, "global::A[]", TestMode.Position);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2341,7 +2330,7 @@ void Goo()
}
}";
- await TestAsync(text, "global::A", testPosition: false);
+ await TestAsync(text, "global::A", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2357,7 +2346,7 @@ void Goo()
}
}";
- await TestAsync(text, "global::A[][]", testNode: false);
+ await TestAsync(text, "global::A[][]", TestMode.Position);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2373,7 +2362,7 @@ void Goo()
}
}";
- await TestAsync(text, "global::A[]", testPosition: false);
+ await TestAsync(text, "global::A[]", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2389,11 +2378,11 @@ void Goo()
}
}";
- await TestAsync(text, "global::A[][]", testNode: false);
+ await TestAsync(text, "global::A[][]", TestMode.Position);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestArrayInference4()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestArrayInference4(TestMode mode)
{
var text =
@"
@@ -2406,12 +2395,12 @@ void Goo()
}
}";
- await TestAsync(text, "global::System.Func");
+ await TestAsync(text, "global::System.Func", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(538993, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/538993")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestInsideLambda2()
+ public async Task TestInsideLambda2(TestMode mode)
{
var text =
@"using System;
@@ -2423,11 +2412,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestInsideLambdaNullableReturn()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestInsideLambdaNullableReturn(TestMode mode)
{
var text =
@"#nullable enable
@@ -2441,12 +2430,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.String?");
+ await TestAsync(text, "global::System.String?", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(539813, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539813")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestPointer1()
+ public async Task TestPointer1(TestMode mode)
{
var text =
@"class C
@@ -2457,12 +2446,12 @@ void M(int* i)
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(539813, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/539813")]
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestDynamic1()
+ public async Task TestDynamic1(TestMode mode)
{
var text =
@"class C
@@ -2473,11 +2462,11 @@ void M(dynamic i)
}
}";
- await TestAsync(text, "global::System.Int32");
+ await TestAsync(text, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestChecked1()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestChecked1(TestMode mode)
{
var text =
@"class C
@@ -2488,12 +2477,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.String");
+ await TestAsync(text, "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(553584, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553584")]
- public async Task TestAwaitTaskOfT()
+ public async Task TestAwaitTaskOfT(TestMode mode)
{
var text =
@"using System.Threading.Tasks;
@@ -2505,11 +2494,11 @@ void M()
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task");
+ await TestAsync(text, "global::System.Threading.Tasks.Task", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestAwaitTaskOfTNullableValue()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestAwaitTaskOfTNullableValue(TestMode mode)
{
var text =
@"#nullable enable
@@ -2523,12 +2512,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task");
+ await TestAsync(text, "global::System.Threading.Tasks.Task", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(553584, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553584")]
- public async Task TestAwaitTaskOfTaskOfT()
+ public async Task TestAwaitTaskOfTaskOfT(TestMode mode)
{
var text =
@"using System.Threading.Tasks;
@@ -2540,12 +2529,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task>");
+ await TestAsync(text, "global::System.Threading.Tasks.Task>", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(553584, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/553584")]
- public async Task TestAwaitTask()
+ public async Task TestAwaitTask(TestMode mode)
{
var text =
@"using System.Threading.Tasks;
@@ -2557,12 +2546,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task");
+ await TestAsync(text, "global::System.Threading.Tasks.Task", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617622, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617622")]
- public async Task TestLockStatement()
+ public async Task TestLockStatement(TestMode mode)
{
var text =
@"class C
@@ -2575,12 +2564,12 @@ void M()
}
}";
- await TestAsync(text, "global::System.Object");
+ await TestAsync(text, "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(617622, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/617622")]
- public async Task TestAwaitExpressionInLockStatement()
+ public async Task TestAwaitExpressionInLockStatement(TestMode mode)
{
var text =
@"class C
@@ -2593,12 +2582,12 @@ async void M()
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task");
+ await TestAsync(text, "global::System.Threading.Tasks.Task", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(827897, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/827897")]
- public async Task TestReturnFromAsyncTaskOfT()
+ public async Task TestReturnFromAsyncTaskOfT(TestMode mode)
{
var markup =
@"using System.Threading.Tasks;
@@ -2610,12 +2599,12 @@ async Task M()
return [|ab|]
}
}";
- await TestAsync(markup, "global::System.Int32");
+ await TestAsync(markup, "global::System.Int32", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(853840, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/853840")]
- public async Task TestAttributeArguments1()
+ public async Task TestAttributeArguments1(TestMode mode)
{
var markup =
@"[A([|dd|], ee, Y = ff)]
@@ -2629,12 +2618,12 @@ public AAttribute(System.DayOfWeek a, double b)
}
}";
- await TestAsync(markup, "global::System.DayOfWeek");
+ await TestAsync(markup, "global::System.DayOfWeek", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(853840, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/853840")]
- public async Task TestAttributeArguments2()
+ public async Task TestAttributeArguments2(TestMode mode)
{
var markup =
@"[A(dd, [|ee|], Y = ff)]
@@ -2648,12 +2637,12 @@ public AAttribute(System.DayOfWeek a, double b)
}
}";
- await TestAsync(markup, "global::System.Double");
+ await TestAsync(markup, "global::System.Double", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(853840, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/853840")]
- public async Task TestAttributeArguments3()
+ public async Task TestAttributeArguments3(TestMode mode)
{
var markup =
@"[A(dd, ee, Y = [|ff|])]
@@ -2667,12 +2656,12 @@ public AAttribute(System.DayOfWeek a, double b)
}
}";
- await TestAsync(markup, "global::System.String");
+ await TestAsync(markup, "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(757111, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/757111")]
- public async Task TestReturnStatementWithinDelegateWithinAMethodCall()
+ public async Task TestReturnStatementWithinDelegateWithinAMethodCall(TestMode mode)
{
var text =
@"using System;
@@ -2691,12 +2680,12 @@ private static void B(A a)
}
}";
- await TestAsync(text, "global::System.String");
+ await TestAsync(text, "global::System.String", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(994388, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/994388")]
- public async Task TestCatchFilterClause()
+ public async Task TestCatchFilterClause(TestMode mode)
{
var text =
@"
@@ -2704,12 +2693,12 @@ public async Task TestCatchFilterClause()
{ }
catch (Exception) if ([|M()|])
}";
- await TestInMethodAsync(text, "global::System.Boolean");
+ await TestInMethodAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(994388, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/994388")]
- public async Task TestCatchFilterClause1()
+ public async Task TestCatchFilterClause1(TestMode mode)
{
var text =
@"
@@ -2717,7 +2706,7 @@ public async Task TestCatchFilterClause1()
{ }
catch (Exception) if ([|M|])
}";
- await TestInMethodAsync(text, "global::System.Boolean");
+ await TestInMethodAsync(text, "global::System.Boolean", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2730,7 +2719,7 @@ public async Task TestCatchFilterClause2()
{ }
catch (Exception) if ([|M|].N)
}";
- await TestInMethodAsync(text, "global::System.Object", testPosition: false);
+ await TestInMethodAsync(text, "global::System.Object", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2748,7 +2737,7 @@ static async void T()
bool x = await [|M()|].ConfigureAwait(false);
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task", testPosition: false);
+ await TestAsync(text, "global::System.Threading.Tasks.Task", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2766,7 +2755,7 @@ static async void T()
bool x = await [|M|].ContinueWith(a => { return true; }).ContinueWith(a => { return false; });
}
}";
- await TestAsync(text, "global::System.Threading.Tasks.Task", testPosition: false);
+ await TestAsync(text, "global::System.Threading.Tasks.Task", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2785,12 +2774,12 @@ private async void M()
private async Task X(T t) { return t; }
}";
- await TestAsync(text, "global::System.Boolean", testPosition: false);
+ await TestAsync(text, "global::System.Boolean", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(4233, "https://github.com/dotnet/roslyn/issues/4233")]
- public async Task TestAwaitExpressionWithGenericMethod2()
+ public async Task TestAwaitExpressionWithGenericMethod2(TestMode mode)
{
var text =
@"using System.Threading.Tasks;
@@ -2804,12 +2793,12 @@ private async void M()
private async Task X(T t) { return t; }
}";
- await TestAsync(text, "global::System.Boolean");
+ await TestAsync(text, "global::System.Boolean", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(4483, "https://github.com/dotnet/roslyn/issues/4483")]
- public async Task TestNullCoalescingOperator1()
+ public async Task TestNullCoalescingOperator1(TestMode mode)
{
var text =
@"class C
@@ -2819,12 +2808,12 @@ void M()
object z = [|a|]?? null;
}
}";
- await TestAsync(text, "global::System.Object");
+ await TestAsync(text, "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(4483, "https://github.com/dotnet/roslyn/issues/4483")]
- public async Task TestNullCoalescingOperator2()
+ public async Task TestNullCoalescingOperator2(TestMode mode)
{
var text =
@"class C
@@ -2834,12 +2823,12 @@ void M()
object z = [|a|] ?? b ?? c;
}
}";
- await TestAsync(text, "global::System.Object");
+ await TestAsync(text, "global::System.Object", mode);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(4483, "https://github.com/dotnet/roslyn/issues/4483")]
- public async Task TestNullCoalescingOperator3()
+ public async Task TestNullCoalescingOperator3(TestMode mode)
{
var text =
@"class C
@@ -2849,7 +2838,7 @@ void M()
object z = a ?? [|b|] ?? c;
}
}";
- await TestAsync(text, "global::System.Object");
+ await TestAsync(text, "global::System.Object", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2867,7 +2856,7 @@ void M(IEnumerable args)
args = args.Select(a =>[||])
}
}";
- await TestAsync(text, "global::System.Object", testPosition: false);
+ await TestAsync(text, "global::System.Object", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2885,12 +2874,12 @@ void M(IEnumerable args)
args = args.Select(a =>[|b|])
}
}";
- await TestAsync(text, "global::System.String", testPosition: false);
+ await TestAsync(text, "global::System.String", TestMode.Node);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
[WorkItem(1903, "https://github.com/dotnet/roslyn/issues/1903")]
- public async Task TestSelectLambda3()
+ public async Task TestSelectLambda3(TestMode mode)
{
var text =
@"using System.Collections.Generic;
@@ -2905,7 +2894,7 @@ IEnumerable GetB(IEnumerable a)
return a.Select(i => [|Goo(i)|]);
}
}";
- await TestAsync(text, "global::B");
+ await TestAsync(text, "global::B", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2920,7 +2909,7 @@ static void Main(string[] args)
System.ConsoleModifiers c = default([||])
}
}";
- await TestAsync(text, "global::System.ConsoleModifiers", testNode: false);
+ await TestAsync(text, "global::System.ConsoleModifiers", TestMode.Position);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2935,7 +2924,7 @@ static void Goo(System.ConsoleModifiers arg)
Goo(default([||])
}
}";
- await TestAsync(text, "global::System.ConsoleModifiers", testNode: false);
+ await TestAsync(text, "global::System.ConsoleModifiers", TestMode.Position);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2951,7 +2940,7 @@ void Goo()
[|ints|].Where(i => i > 10);
}
}";
- await TestAsync(text, "global::System.Collections.Generic.IEnumerable", testPosition: false);
+ await TestAsync(text, "global::System.Collections.Generic.IEnumerable", TestMode.Node);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -2967,7 +2956,7 @@ void Goo()
[|ints|].Where(i => null);
}
}";
- await TestAsync(text, "global::System.Collections.Generic.IEnumerable", testPosition: false);
+ await TestAsync(text, "global::System.Collections.Generic.IEnumerable", TestMode.Node);
}
[WorkItem(12755, "https://github.com/dotnet/roslyn/issues/12755")]
@@ -2986,7 +2975,7 @@ void M()
}
}";
- await TestAsync(text, "global::C", testNode: false);
+ await TestAsync(text, "global::C", TestMode.Position);
}
[WorkItem(15468, "https://github.com/dotnet/roslyn/issues/15468")]
@@ -2995,7 +2984,7 @@ void M()
public async Task TestDeconstruction()
{
await TestInMethodAsync(
-@"[|(int i, _)|] =", "(global::System.Int32 i, global::System.Object _)", testPosition: false);
+@"[|(int i, _)|] =", "(global::System.Int32 i, global::System.Object _)", TestMode.Node);
}
[WorkItem(15468, "https://github.com/dotnet/roslyn/issues/15468")]
@@ -3004,14 +2993,14 @@ public async Task TestDeconstruction()
public async Task TestDeconstruction2()
{
await TestInMethodAsync(
-@"(int i, _) = [||]", "(global::System.Int32 i, global::System.Object _)", testNode: false);
+@"(int i, _) = [||]", "(global::System.Int32 i, global::System.Object _)", TestMode.Position);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
public async Task TestDeconstructionWithNullableElement()
{
await TestInMethodAsync(
-@"[|(string? s, _)|] =", "(global::System.String? s, global::System.Object _)", testPosition: false);
+@"[|(string? s, _)|] =", "(global::System.String? s, global::System.Object _)", TestMode.Node);
}
[WorkItem(13402, "https://github.com/dotnet/roslyn/issues/13402")]
@@ -3028,11 +3017,11 @@ static void Main(string[] args)
}
}";
- await TestAsync(text, "global::Program", testNode: false);
+ await TestAsync(text, "global::Program", TestMode.Position);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestInferringThroughGenericFunctionWithNullableReturn()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestInferringThroughGenericFunctionWithNullableReturn(TestMode mode)
{
var text =
@"#nullable enable
@@ -3047,7 +3036,7 @@ static void Main(string[] args)
static T Identity(T value) { return value; }
}";
- await TestAsync(text, "global::System.String?");
+ await TestAsync(text, "global::System.String?", mode);
}
[Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
@@ -3064,11 +3053,11 @@ static void Main(string[] args)
static T Identity(T value) { return value; }
}";
- await TestAsync(text, "global::System.String", testNode: false);
+ await TestAsync(text, "global::System.String", TestMode.Position);
}
- [Fact, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
- public async Task TestInferringThroughGenericFunctionTooManyArguments()
+ [Theory, CombinatorialData, Trait(Traits.Feature, Traits.Features.TypeInferenceService)]
+ public async Task TestInferringThroughGenericFunctionTooManyArguments(TestMode mode)
{
var text =
@"class Program
@@ -3081,7 +3070,7 @@ static void Main(string[] args)
static T Identity(T value) { return value; }
}";
- await TestAsync(text, "global::System.Object");
+ await TestAsync(text, "global::System.Object", mode);
}
}
}
diff --git a/src/EditorFeatures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs b/src/EditorFeatures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs
index 8cc4c676d38d921caad38df988739a4a7bbf858a..e35b3a645f76ac09d0364cdf8ec8b8e365333325 100644
--- a/src/EditorFeatures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs
+++ b/src/EditorFeatures/TestUtilities/TypeInferrer/TypeInferrerTestBase.cs
@@ -37,39 +37,37 @@ private static async Task CanUseSpeculativeSemanticModelAsync(Document doc
return !service.GetMemberBodySpanForSpeculativeBinding(node).IsEmpty;
}
- protected async Task TestAsync(string text, string expectedType, bool testNode = true, bool testPosition = true,
- SourceCodeKind sourceCodeKind = SourceCodeKind.Regular)
+ ///
+ /// Specifies which overload of the will be tested.
+ ///
+ public enum TestMode
{
- MarkupTestFile.GetSpan(text.NormalizeLineEndings(), out text, out var textSpan);
-
- if (testNode)
- {
- await TestWithAndWithoutSpeculativeSemanticModelAsync(text, textSpan, expectedType, useNodeStartPosition: false, sourceCodeKind);
- }
+ ///
+ /// Specifies the test is going to call into .
+ ///
+ Node,
- if (testPosition)
- {
- await TestWithAndWithoutSpeculativeSemanticModelAsync(text, textSpan, expectedType, useNodeStartPosition: true, sourceCodeKind);
- }
+ ///
+ /// Specifies the test is going to call into .
+ ///
+ Position
}
- private async Task TestWithAndWithoutSpeculativeSemanticModelAsync(
- string text,
- TextSpan textSpan,
- string expectedType,
- bool useNodeStartPosition,
- SourceCodeKind sourceCodeKind)
+ protected async Task TestAsync(string text, string expectedType, TestMode mode,
+ SourceCodeKind sourceCodeKind = SourceCodeKind.Regular)
{
+ MarkupTestFile.GetSpan(text.NormalizeLineEndings(), out text, out var textSpan);
+
var document = fixture.UpdateDocument(text, sourceCodeKind);
- await TestWorkerAsync(document, textSpan, expectedType, useNodeStartPosition);
+ await TestWorkerAsync(document, textSpan, expectedType, mode);
if (await CanUseSpeculativeSemanticModelAsync(document, textSpan.Start))
{
var document2 = fixture.UpdateDocument(text, sourceCodeKind, cleanBeforeUpdate: false);
- await TestWorkerAsync(document2, textSpan, expectedType, useNodeStartPosition);
+ await TestWorkerAsync(document2, textSpan, expectedType, mode);
}
}
- protected abstract Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, bool useNodeStartPosition);
+ protected abstract Task TestWorkerAsync(Document document, TextSpan textSpan, string expectedType, TestMode mode);
}
}
diff --git a/src/EditorFeatures/VisualBasicTest/Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests.vbproj b/src/EditorFeatures/VisualBasicTest/Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests.vbproj
index c747ebe57eef7029e18c0b6d0007f65d371e235d..44bc875fdba9f2d9740f9f1e0012c94e995955cc 100644
--- a/src/EditorFeatures/VisualBasicTest/Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests.vbproj
+++ b/src/EditorFeatures/VisualBasicTest/Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.UnitTests.vbproj
@@ -59,6 +59,7 @@
+
diff --git a/src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb b/src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
index 7947cfc9f8abc7e97431eaa6c0a6a8dbca5fa495..15c7b37203a07b7cff894d1b6e39c829fcbec445 100644
--- a/src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
+++ b/src/EditorFeatures/VisualBasicTest/TypeInferrer/TypeInferrerTests.vb
@@ -17,33 +17,36 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.TypeInferrer
MyBase.New(workspaceFixture)
End Sub
- Protected Overrides Async Function TestWorkerAsync(document As Document, textSpan As TextSpan, expectedType As String, useNodeStartPosition As Boolean) As Task
+ Protected Overrides Async Function TestWorkerAsync(document As Document, textSpan As TextSpan, expectedType As String, testMode As TestMode) As Task
Dim root = Await document.GetSyntaxRootAsync()
Dim node = FindExpressionSyntaxFromSpan(root, textSpan)
Dim typeInference = document.GetLanguageService(Of ITypeInferenceService)()
- Dim inferredType = If(
- useNodeStartPosition,
- typeInference.InferType(Await document.GetSemanticModelForSpanAsync(New TextSpan(node.SpanStart, 0), CancellationToken.None), node.SpanStart, objectAsDefault:=True, cancellationToken:=CancellationToken.None),
- typeInference.InferType(Await document.GetSemanticModelForSpanAsync(node.Span, CancellationToken.None), node, objectAsDefault:=True, cancellationToken:=CancellationToken.None))
+ Dim inferredType As ITypeSymbol
+
+ If testMode = TestMode.Position Then
+ inferredType = typeInference.InferType(Await document.GetSemanticModelForSpanAsync(New TextSpan(node.SpanStart, 0), CancellationToken.None), node.SpanStart, objectAsDefault:=True, cancellationToken:=CancellationToken.None)
+ Else
+ inferredType = typeInference.InferType(Await document.GetSemanticModelForSpanAsync(node.Span, CancellationToken.None), node, objectAsDefault:=True, cancellationToken:=CancellationToken.None)
+ End If
Dim typeSyntax = inferredType.GenerateTypeSyntax().NormalizeWhitespace()
End Function
- Private Async Function TestInClassAsync(text As String, expectedType As String) As Tasks.Task
+ Private Async Function TestInClassAsync(text As String, expectedType As String, mode As TestMode) As Tasks.Task
text = Class C
$
End Class.Value.Replace("$", text)
- Await TestAsync(text, expectedType)
+ Await TestAsync(text, expectedType, mode)
End Function
- Private Async Function TestInMethodAsync(text As String, expectedType As String, Optional testNode As Boolean = True, Optional testPosition As Boolean = True) As Tasks.Task
+ Private Async Function TestInMethodAsync(text As String, expectedType As String, mode As TestMode) As Tasks.Task
text = Class C
Sub M()
$
End Sub
End Class.Value.Replace("$", text)
- Await TestAsync(text, expectedType, testNode:=testNode, testPosition:=testPosition)
+ Await TestAsync(text, expectedType, mode)
End Function
Private Function FindExpressionSyntaxFromSpan(root As SyntaxNode, textSpan As TextSpan) As ExpressionSyntax
@@ -61,317 +64,319 @@ End Class.Value.Replace("$", text)
Return Nothing
End Function
-
- Public Async Function TestConditional1() As Task
- Await TestInMethodAsync("Dim q = If([|Goo()|], 1, 2)", "System.Boolean")
+
+ Public Async Function TestConditional1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = If([|Goo()|], 1, 2)", "System.Boolean", mode)
End Function
-
- Public Async Function TestConditional2() As Task
- Await TestInMethodAsync("Dim q = If(a, [|Goo()|], 2)", "System.Int32")
+
+ Public Async Function TestConditional2(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = If(a, [|Goo()|], 2)", "System.Int32", mode)
End Function
-
- Public Async Function TestConditional3() As Task
- Await TestInMethodAsync("Dim q = If(a, """", [|Goo()|])", "System.String")
+
+ Public Async Function TestConditional3(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = If(a, """", [|Goo()|])", "System.String", mode)
End Function
-
- Public Async Function TestVariableDeclarator1() As Task
- Await TestInMethodAsync("Dim q As Integer = [|Goo()|]", "System.Int32")
+
+ Public Async Function TestVariableDeclarator1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q As Integer = [|Goo()|]", "System.Int32", mode)
End Function
-
- Public Async Function TestVariableDeclarator2() As Task
- Await TestInMethodAsync("Dim q = [|Goo()|]", "System.Object")
+
+ Public Async Function TestVariableDeclarator2(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = [|Goo()|]", "System.Object", mode)
End Function
-
+
- Public Async Function TestCoalesce1() As Task
- Await TestInMethodAsync("Dim q = If([|Goo()|], 1)", "System.Int32?")
+ Public Async Function TestCoalesce1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = If([|Goo()|], 1)", "System.Int32?", mode)
End Function
-
+
- Public Async Function TestCoalesce2() As Task
+ Public Async Function TestCoalesce2(mode As TestMode) As Task
Await TestInMethodAsync(Dim b as Boolean?
- Dim q = If(b, [|Goo()|]).Value, "System.Boolean")
+ Dim q = If(b, [|Goo()|]).Value, "System.Boolean", mode)
End Function
-
+
- Public Async Function TestCoalesce3() As Task
+ Public Async Function TestCoalesce3(mode As TestMode) As Task
Await TestInMethodAsync(Dim s As String
- Dim q = If(s, [|Goo()|]).Value, "System.String")
+ Dim q = If(s, [|Goo()|]).Value, "System.String", mode)
End Function
-
+
- Public Async Function TestCoalesce4() As Task
- Await TestInMethodAsync("Dim q = If([|Goo()|], String.Empty)", "System.String")
+ Public Async Function TestCoalesce4(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = If([|Goo()|], String.Empty)", "System.String", mode)
End Function
-
- Public Async Function TestBinaryExpression1() As Task
+
+ Public Async Function TestBinaryExpression1(mode As TestMode) As Task
Await TestInMethodAsync(Dim s As String
- Dim q = s + [|Goo()|].Value, "System.String")
+ Dim q = s + [|Goo()|].Value, "System.String", mode)
End Function
-
- Public Async Function TestBinaryExpression1_1() As Task
+
+ Public Async Function TestBinaryExpression1_1(mode As TestMode) As Task
Await TestInMethodAsync(Dim s As String
- Dim q = s & [|Goo()|].Value, "System.String")
+ Dim q = s & [|Goo()|].Value, "System.String", mode)
End Function
-
- Public Async Function TestBinaryExpression2() As Task
+
+ Public Async Function TestBinaryExpression2(mode As TestMode) As Task
Await TestInMethodAsync(Dim s
- Dim q = s OrElse [|Goo()|].Value, "System.Boolean")
+ Dim q = s OrElse [|Goo()|].Value, "System.Boolean", mode)
End Function
-
- Public Async Function TestBinaryOperator1() As Task
- Await TestInMethodAsync("Dim q = x << [|Goo()|]", "System.Int32")
+
+ Public Async Function TestBinaryOperator1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = x << [|Goo()|]", "System.Int32", mode)
End Function
-
- Public Async Function TestBinaryOperator2() As Task
- Await TestInMethodAsync("Dim q = x >> [|Goo()|]", "System.Int32")
+
+ Public Async Function TestBinaryOperator2(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = x >> [|Goo()|]", "System.Int32", mode)
End Function
-
- Public Async Function TestBinaryOperator3() As Task
- Await TestInMethodAsync("Dim q : q <<= [|Goo()|]", "System.Int32")
+
+
+ Public Async Function TestBinaryOperator3(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q : q <<= [|Goo()|]", "System.Int32", mode)
End Function
-
- Public Async Function TestBinaryOperator4() As Task
- Await TestInMethodAsync("Dim q : q >>= [|Goo()|]", "System.Int32")
+
+
+ Public Async Function TestBinaryOperator4(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q : q >>= [|Goo()|]", "System.Int32", mode)
End Function
Public Async Function TestBinaryOperator5() As Task
- Await TestInMethodAsync("Dim q : [|somefield|] <<= q", "System.Int32", testPosition:=False)
+ Await TestInMethodAsync("Dim q : [|somefield|] <<= q", "System.Int32", TestMode.Node)
End Function
Public Async Function TestBinaryOperator6() As Task
- Await TestInMethodAsync("Dim q : [|somefield|] >>= q", "System.Int32", testPosition:=False)
+ Await TestInMethodAsync("Dim q : [|somefield|] >>= q", "System.Int32", TestMode.Node)
End Function
-
- Public Async Function TestBinaryOperator7() As Task
- Await TestInMethodAsync("Dim q As String : q >>= [|Goo()|]", "System.Int32")
+
+ Public Async Function TestBinaryOperator7(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q As String : q >>= [|Goo()|]", "System.Int32", mode)
End Function
Public Async Function TestBinaryOperator8() As Task
- Await TestInMethodAsync("Dim q As String : [|somefield|] >>= q", "System.Int32", testPosition:=False)
+ Await TestInMethodAsync("Dim q As String : [|somefield|] >>= q", "System.Int32", TestMode.Node)
End Function
-
- Public Async Function TestReturn1() As Task
- Await TestInClassAsync("Function M() As Integer : Return [|Goo()|] : End Function", "System.Int32")
+
+ Public Async Function TestReturn1(mode As TestMode) As Task
+ Await TestInClassAsync("Function M() As Integer : Return [|Goo()|] : End Function", "System.Int32", mode)
End Function
-
- Public Async Function TestReturn2() As Task
- Await TestInMethodAsync("Return [|Goo()|]", "Global.System.Void")
+
+ Public Async Function TestReturn2(mode As TestMode) As Task
+ Await TestInMethodAsync("Return [|Goo()|]", "Global.System.Void", mode)
End Function
-
- Public Async Function TestReturn3() As Task
- Await TestInClassAsync("Property Prop As Integer : Get : Return [|Goo()|] : End Get : End Property", "System.Int32")
+
+ Public Async Function TestReturn3(mode As TestMode) As Task
+ Await TestInClassAsync("Property Prop As Integer : Get : Return [|Goo()|] : End Get : End Property", "System.Int32", mode)
End Function
-
+
- Public Async Function TestYieldReturn() As Task
- Await TestInClassAsync("Iterator Function M() As System.Collections.Generic.IEnumerable(Of Integer) : Yield [|abc|] : End Function", "System.Int32")
+ Public Async Function TestYieldReturn(mode As TestMode) As Task
+ Await TestInClassAsync("Iterator Function M() As System.Collections.Generic.IEnumerable(Of Integer) : Yield [|abc|] : End Function", "System.Int32", mode)
End Function
-
+
- Public Async Function TestReturnInLambda() As Task
+ Public Async Function TestReturnInLambda(mode As TestMode) As Task
Await TestInMethodAsync(Dim F As System.Func(Of String, Integer) = Function (s)
Return [|Goo()|]
- End Function
.Value, "System.Int32")
+ End Function.Value, "System.Int32", mode)
End Function
-
+
- Public Async Function TestInsideLambda2() As Task
+ Public Async Function TestInsideLambda2(mode As TestMode) As Task
Dim text = Imports System
Class A
Sub Goo()
Dim f As Func(Of Integer, Integer) = Function(i) [|here|]
End Sub
End Class.Value
- Await TestAsync(text, "System.Int32")
+ Await TestAsync(text, "System.Int32", mode)
End Function
-
+
- Public Async Function TestLambda() As Task
- Await TestInMethodAsync("Dim f As System.Func(Of String, Integer) = Function (s) [|Goo()|]", "System.Int32")
+ Public Async Function TestLambda(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim f As System.Func(Of String, Integer) = Function (s) [|Goo()|]", "System.Int32", mode)
End Function
-
- Public Async Function TestThrow() As Task
- Await TestInMethodAsync("Throw [|Goo()|]", "Global.System.Exception")
+
+ Public Async Function TestThrow(mode As TestMode) As Task
+ Await TestInMethodAsync("Throw [|Goo()|]", "Global.System.Exception", mode)
End Function
-
- Public Async Function TestCatch() As Task
- Await TestInMethodAsync("Try : Catch e As [|Goo|] : End Try", "Global.System.Exception")
+
+ Public Async Function TestCatch(mode As TestMode) As Task
+ Await TestInMethodAsync("Try : Catch e As [|Goo|] : End Try", "Global.System.Exception", mode)
End Function
-
- Public Async Function TestIf() As Task
- Await TestInMethodAsync("If [|Goo()|] : End If", "System.Boolean")
+
+ Public Async Function TestIf(mode As TestMode) As Task
+ Await TestInMethodAsync("If [|Goo()|] : End If", "System.Boolean", mode)
End Function
-
- Public Async Function TestWhile() As Task
- Await TestInMethodAsync("While [|Goo()|] : End While", "System.Boolean")
+
+ Public Async Function TestWhile(mode As TestMode) As Task
+ Await TestInMethodAsync("While [|Goo()|] : End While", "System.Boolean", mode)
End Function
-
- Public Async Function TestDo() As Task
- Await TestInMethodAsync("Do : Loop While [|Goo()|]", "System.Boolean")
+
+ Public Async Function TestDo(mode As TestMode) As Task
+ Await TestInMethodAsync("Do : Loop While [|Goo()|]", "System.Boolean", mode)
End Function
-
+
- Public Async Function TestFor2() As Task
- Await TestInMethodAsync("For i As Integer = 1 To 2 Step [|Goo|]", "System.Int32")
+ Public Async Function TestFor2(mode As TestMode) As Task
+ Await TestInMethodAsync("For i As Integer = 1 To 2 Step [|Goo|]", "System.Int32", mode)
End Function
-
- Public Async Function TestUsing1() As Task
- Await TestInMethodAsync("Using [|Goo()|] : End Using", "Global.System.IDisposable")
+
+ Public Async Function TestUsing1(mode As TestMode) As Task
+ Await TestInMethodAsync("Using [|Goo()|] : End Using", "Global.System.IDisposable", mode)
End Function
-
- Public Async Function TestUsing2() As Task
- Await TestInMethodAsync("Using i As Integer = [|Goo()|] : End Using", "System.Int32")
+
+ Public Async Function TestUsing2(mode As TestMode) As Task
+ Await TestInMethodAsync("Using i As Integer = [|Goo()|] : End Using", "System.Int32", mode)
End Function
-
+
- Public Async Function TestUsing3() As Task
- Await TestInMethodAsync("Using v = [|Goo()|] : End Using", "Global.System.IDisposable")
+ Public Async Function TestUsing3(mode As TestMode) As Task
+ Await TestInMethodAsync("Using v = [|Goo()|] : End Using", "Global.System.IDisposable", mode)
End Function
-
+
- Public Async Function TestForEach() As Task
- Await TestInMethodAsync("For Each v As Integer in [|Goo()|] : Next", "Global.System.Collections.Generic.IEnumerable(Of System.Int32)")
+ Public Async Function TestForEach(mode As TestMode) As Task
+ Await TestInMethodAsync("For Each v As Integer in [|Goo()|] : Next", "Global.System.Collections.Generic.IEnumerable(Of System.Int32)", mode)
End Function
-
- Public Async Function TestPrefixExpression1() As Task
- Await TestInMethodAsync("Dim q = +[|Goo()|]", "System.Int32")
+
+ Public Async Function TestPrefixExpression1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = +[|Goo()|]", "System.Int32", mode)
End Function
-
- Public Async Function TestPrefixExpression2() As Task
- Await TestInMethodAsync("Dim q = -[|Goo()|]", "System.Int32")
+
+ Public Async Function TestPrefixExpression2(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = -[|Goo()|]", "System.Int32", mode)
End Function
-
+
- Public Async Function TestPrefixExpression3() As Task
- Await TestInMethodAsync("Dim q = Not [|Goo()|] And 5", "System.Int32")
+ Public Async Function TestPrefixExpression3(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = Not [|Goo()|] And 5", "System.Int32", mode)
End Function
-
- Public Async Function TestPrefixExpression4() As Task
- Await TestInMethodAsync("Dim q = Not [|Goo()|]", "System.Boolean")
+
+ Public Async Function TestPrefixExpression4(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q = Not [|Goo()|]", "System.Boolean", mode)
End Function
-
+
- Public Async Function TestArrayRankSpecifier1() As Task
- Await TestInMethodAsync("Dim q As String() = New String([|Goo()|])", "System.Char()")
+ Public Async Function TestArrayRankSpecifier1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q As String() = New String([|Goo()|])", "System.Char()", mode)
End Function
-
+
- Public Async Function TestArrayRankSpecifier2() As Task
- Await TestInMethodAsync("Dim q As String() = New String([|Goo()|]) { }", "System.Int32")
+ Public Async Function TestArrayRankSpecifier2(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim q As String() = New String([|Goo()|]) { }", "System.Int32", mode)
End Function
-
- Public Async Function TestSwitch1() As Task
- Await TestInMethodAsync("Select Case [|Goo()|] : End Select", "System.Int32")
+
+ Public Async Function TestSwitch1(mode As TestMode) As Task
+ Await TestInMethodAsync("Select Case [|Goo()|] : End Select", "System.Int32", mode)
End Function
-
- Public Async Function TestSwitch2() As Task
- Await TestInMethodAsync("Select Case [|Goo()|] : Case Else: End Select", "System.Int32")
+
+ Public Async Function TestSwitch2(mode As TestMode) As Task
+ Await TestInMethodAsync("Select Case [|Goo()|] : Case Else: End Select", "System.Int32", mode)
End Function
-
- Public Async Function TestSwitch3() As Task
- Await TestInMethodAsync("Select Case [|Goo()|] : Case ""a"": End Select", "System.String")
+
+ Public Async Function TestSwitch3(mode As TestMode) As Task
+ Await TestInMethodAsync("Select Case [|Goo()|] : Case ""a"": End Select", "System.String", mode)
End Function
-
- Public Async Function TestMethodCall1() As Task
- Await TestInMethodAsync("Bar([|Goo()|])", "System.Object")
+
+ Public Async Function TestMethodCall1(mode As TestMode) As Task
+ Await TestInMethodAsync("Bar([|Goo()|])", "System.Object", mode)
End Function
-
- Public Async Function TestMethodCall2() As Task
- Await TestInClassAsync("Sub M() : Bar([|Goo()|]) : End Sub : Sub Bar(i As Integer) : End Sub", "System.Int32")
+
+ Public Async Function TestMethodCall2(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Bar([|Goo()|]) : End Sub : Sub Bar(i As Integer) : End Sub", "System.Int32", mode)
End Function
-
- Public Async Function TestMethodCall3() As Task
- Await TestInClassAsync("Sub M() : Bar([|Goo()|]) : End Sub : Sub Bar() : End Sub", "System.Object")
+
+ Public Async Function TestMethodCall3(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Bar([|Goo()|]) : End Sub : Sub Bar() : End Sub", "System.Object", mode)
End Function
-
- Public Async Function TestMethodCall4() As Task
- Await TestInClassAsync("Sub M() : Bar([|Goo()|]) : End Sub : Sub Bar(i As Integer, s As String) : End Sub", "System.Int32")
+
+ Public Async Function TestMethodCall4(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Bar([|Goo()|]) : End Sub : Sub Bar(i As Integer, s As String) : End Sub", "System.Int32", mode)
End Function
-
- Public Async Function TestMethodCall5() As Task
- Await TestInClassAsync("Sub M() : Bar(s:=[|Goo()|]) : End Sub : Sub Bar(i As Integer, s As String) : End Sub", "System.String")
+
+ Public Async Function TestMethodCall5(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Bar(s:=[|Goo()|]) : End Sub : Sub Bar(i As Integer, s As String) : End Sub", "System.String", mode)
End Function
-
- Public Async Function TestConstructorCall1() As Task
- Await TestInMethodAsync("Dim l = New C([|Goo()|])", "System.Object")
+
+ Public Async Function TestConstructorCall1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim l = New C([|Goo()|])", "System.Object", mode)
End Function
-
- Public Async Function TestConstructorCall2() As Task
- Await TestInClassAsync("Sub M() : Dim l = New C([|Goo()|]) : End Sub : Sub New(i As Integer) : End Sub", "System.Int32")
+
+ Public Async Function TestConstructorCall2(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Dim l = New C([|Goo()|]) : End Sub : Sub New(i As Integer) : End Sub", "System.Int32", mode)
End Function
-
- Public Async Function TestConstructorCall3() As Task
- Await TestInClassAsync("Sub M() : Dim l = New C([|Goo()|]) : End Sub : Sub New() : End Sub", "System.Object")
+
+ Public Async Function TestConstructorCall3(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Dim l = New C([|Goo()|]) : End Sub : Sub New() : End Sub", "System.Object", mode)
End Function
-
- Public Async Function TestConstructorCall4() As Task
- Await TestInClassAsync("Sub M() : Dim l = New C([|Goo()|]) : End Sub : Sub New(i As Integer, s As String) : End Sub", "System.Int32")
+
+ Public Async Function TestConstructorCall4(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Dim l = New C([|Goo()|]) : End Sub : Sub New(i As Integer, s As String) : End Sub", "System.Int32", mode)
End Function
-
- Public Async Function TestConstructorCall5() As Task
- Await TestInClassAsync("Sub M() : Dim l = New C(s:=[|Goo()|]) : End Sub : Sub New(i As Integer, s As String) : End Sub", "System.String")
+
+ Public Async Function TestConstructorCall5(mode As TestMode) As Task
+ Await TestInClassAsync("Sub M() : Dim l = New C(s:=[|Goo()|]) : End Sub : Sub New(i As Integer, s As String) : End Sub", "System.String", mode)
End Function
-
+
- Public Async Function TestIndexAccess1() As Task
- Await TestInMethodAsync("Dim i As String() : Dim j = i([|Goo()|])", "System.Int32")
+ Public Async Function TestIndexAccess1(mode As TestMode) As Task
+ Await TestInMethodAsync("Dim i As String() : Dim j = i([|Goo()|])", "System.Int32", mode)
End Function
@@ -385,7 +390,7 @@ Class C
Dim l = New List(Of Integer)() From { [|Goo()|] }
End Sub
End Class.Value
- Await TestAsync(text, "System.Int32", testPosition:=False)
+ Await TestAsync(text, "System.Int32", TestMode.Node)
End Function
@@ -400,7 +405,7 @@ Class C
Dim l = New Dictionary(Of Integer, String)() From { { [|Goo()|], String.Empty } }
End Sub
End Class.Value
- Await TestAsync(text, "System.Int32", testPosition:=False)
+ Await TestAsync(text, "System.Int32", TestMode.Node)
End Function
@@ -415,7 +420,7 @@ Class C
Dim l = new Dictionary(Of Integer, String)() From { { 0, [|Goo()|] } }
End Sub
End Class.Value
- Await TestAsync(text, "System.String", testPosition:=False)
+ Await TestAsync(text, "System.String", TestMode.Node)
End Function
@@ -441,7 +446,7 @@ Class C
End Function
End Class
.Value
- Await TestAsync(text, "System.Int32", testPosition:=False)
+ Await TestAsync(text, "System.Int32", TestMode.Node)
End Function
@@ -466,7 +471,7 @@ Class C
Throw New NotImplementedException()
End Function
End Class.Value
- Await TestAsync(text, "System.Boolean", testPosition:=False)
+ Await TestAsync(text, "System.Boolean", TestMode.Node)
End Function
@@ -491,11 +496,11 @@ Class C
Throw New NotImplementedException()
End Function
End Class.Value
- Await TestAsync(text, "System.String", testPosition:=False)
+ Await TestAsync(text, "System.String", TestMode.Node)
End Function
-
- Public Async Function TestArrayInference1() As Task
+
+ Public Async Function TestArrayInference1(mode As TestMode) As Task
' TODO: review this
Dim text =
Class A
@@ -503,11 +508,11 @@ Class A
Dim x As A() = new [|C|]() { }
End Sub
End Class.Value
- Await TestAsync(text, "Global.A")
+ Await TestAsync(text, "Global.A", mode)
End Function
-
- Public Async Function TestArrayInference2() As Task
+
+ Public Async Function TestArrayInference2(mode As TestMode) As Task
' TODO: review this
Dim text =
Class A
@@ -515,11 +520,11 @@ Class A
Dim x As A()() = new [|C|]()() { }
End Sub
End Class.Value
- Await TestAsync(text, "Global.A()")
+ Await TestAsync(text, "Global.A()", mode)
End Function
-
- Public Async Function TestArrayInference3() As Task
+
+ Public Async Function TestArrayInference3(mode As TestMode) As Task
' TODO: review this
Dim text =
Class A
@@ -527,23 +532,23 @@ Class A
Dim x As A()() = new [|C|]() { }
End Sub
End Class.Value
- Await TestAsync(text, "Global.A()")
+ Await TestAsync(text, "Global.A()", mode)
End Function
-
- Public Async Function TestDynamic1() As Task
+
+ Public Async Function TestDynamic1(mode As TestMode) As Task
Dim text =
Class C
Sub M(i As Dynamic)
Dim q = i([|Goo()|]);
End Sub
End Class.Value
- Await TestAsync(text, "System.Object")
+ Await TestAsync(text, "System.Object", mode)
End Function
-
+
- Public Async Function TestAwaitTaskOfT() As Task
+ Public Async Function TestAwaitTaskOfT(mode As TestMode) As Task
Dim text =
Imports System.Threading.Tasks
@@ -552,12 +557,12 @@ Class C
Dim x As Integer = Await [|Goo()|]
End Sub
End Class.Value
- Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of System.Int32)")
+ Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of System.Int32)", mode)
End Function
-
+
- Public Async Function TestAwaitTaskOfTaskOfT() As Task
+ Public Async Function TestAwaitTaskOfTaskOfT(mode As TestMode) As Task
Dim text =
Imports System.Threading.Tasks
@@ -566,12 +571,12 @@ Class C
Dim x As Task(Of Integer) = Await [|Goo()|]
End Sub
End Class.Value
- Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of Global.System.Threading.Tasks.Task(Of System.Int32))")
+ Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of Global.System.Threading.Tasks.Task(Of System.Int32))", mode)
End Function
-
+
- Public Async Function TestAwaitTask() As Task
+ Public Async Function TestAwaitTask(mode As TestMode) As Task
Dim text =
Imports System.Threading.Tasks
@@ -580,18 +585,18 @@ Class C
Await [|Goo()|]
End Sub
End Class.Value
- Await TestAsync(text, "Global.System.Threading.Tasks.Task")
+ Await TestAsync(text, "Global.System.Threading.Tasks.Task", mode)
End Function
-
+
- Public Async Function TestReturnFromAsyncTaskOfT() As Task
- Await TestInClassAsync("Async Function M() As System.Threading.Tasks.Task(Of Integer) : Return [|abc|] : End Function", "System.Int32")
+ Public Async Function TestReturnFromAsyncTaskOfT(mode As TestMode) As Task
+ Await TestInClassAsync("Async Function M() As System.Threading.Tasks.Task(Of Integer) : Return [|abc|] : End Function", "System.Int32", mode)
End Function
-
+
- Public Async Function TestNamedFieldInitializer() As Task
+ Public Async Function TestNamedFieldInitializer(mode As TestMode) As Task
Dim text =
Imports System.Linq
Module Module1
@@ -608,12 +613,12 @@ Public Class Car
Public Color As Color
End Class
.Value
- Await TestAsync(text, "Global.Color")
+ Await TestAsync(text, "Global.Color", mode)
End Function
-
+
- Public Async Function TestAttributeArguments1() As Task
+ Public Async Function TestAttributeArguments1(mode As TestMode) As Task
Dim text =
<AAttribute([|dd|], ee, Y:=ff)>
Class AAttribute
@@ -626,12 +631,12 @@ Class AAttribute
End Sub
End Class
.Value
- Await TestAsync(text, "Global.System.DayOfWeek")
+ Await TestAsync(text, "Global.System.DayOfWeek", mode)
End Function
-
+
- Public Async Function TestAttributeArguments2() As Task
+ Public Async Function TestAttributeArguments2(mode As TestMode) As Task
Dim text =
<AAttribute(dd, [|ee|], Y:=ff)>
Class AAttribute
@@ -644,12 +649,12 @@ Class AAttribute
End Sub
End Class
.Value
- Await TestAsync(text, "System.Double")
+ Await TestAsync(text, "System.Double", mode)
End Function
-
+
- Public Async Function TestAttributeArguments3() As Task
+ Public Async Function TestAttributeArguments3(mode As TestMode) As Task
Dim text =
<AAttribute(dd, ee, Y:=[|ff|])>
Class AAttribute
@@ -662,35 +667,35 @@ Class AAttribute
End Sub
End Class
.Value
- Await TestAsync(text, "System.String")
+ Await TestAsync(text, "System.String", mode)
End Function
-
+
- Public Async Function TestCatchFilterClause() As Task
+ Public Async Function TestCatchFilterClause(mode As TestMode) As Task
Dim text = "Try : Catch ex As Exception When [|goo()|]"
- Await TestInMethodAsync(text, "System.Boolean")
+ Await TestInMethodAsync(text, "System.Boolean", mode)
End Function
-
+
- Public Async Function TestCatchFilterClause1() As Task
+ Public Async Function TestCatchFilterClause1(mode As TestMode) As Task
Dim text = "Try : Catch ex As Exception When [|goo|]"
- Await TestInMethodAsync(text, "System.Boolean")
+ Await TestInMethodAsync(text, "System.Boolean", mode)
End Function
Public Async Function TestCatchFilterClause2() As Task
Dim text = "Try : Catch ex As Exception When [|goo|].N"
- Await TestInMethodAsync(text, "System.Object", testPosition:=False)
+ Await TestInMethodAsync(text, "System.Object", TestMode.Node)
End Function
-
+
- Public Async Function ConditionalInvocation() As Task
+ Public Async Function ConditionalInvocation(mode As TestMode) As Task
Dim text = "Dim args As String() : args?([|goo|])"
- Await TestInMethodAsync(text, "System.Int32", testPosition:=True)
+ Await TestInMethodAsync(text, "System.Int32", mode)
End Function
@@ -704,7 +709,7 @@ Module M
Dim x As Boolean = Await [|F|].ContinueWith(Function(a) True).ContinueWith(Function(a) False)
End Sub
End Module"
- Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of System.Object)", testPosition:=False)
+ Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of System.Object)", TestMode.Node)
End Function
@@ -718,7 +723,7 @@ Module M
Dim x As Boolean = Await [|F|].ConfigureAwait(False)
End Sub
End Module"
- Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of System.Boolean)", testPosition:=False)
+ Await TestAsync(text, "Global.System.Threading.Tasks.Task(Of System.Boolean)", TestMode.Node)
End Function
@@ -733,7 +738,7 @@ End Module"
Sub M(x As Integer)
End Sub
End Class"
- Await TestAsync(text, "System.Object", testNode:=False, testPosition:=True)
+ Await TestAsync(text, "System.Object", TestMode.Position)
End Function
@@ -745,7 +750,7 @@ class C
[|ints|].Where(function(i) i > 10)
end sub
end class"
- Await TestAsync(text, "Global.System.Collections.Generic.IEnumerable(Of System.Int32)", testPosition:=False)
+ Await TestAsync(text, "Global.System.Collections.Generic.IEnumerable(Of System.Int32)", TestMode.Node)
End Function
@@ -759,7 +764,7 @@ class C
end function)
end sub
end class"
- Await TestAsync(text, "Global.System.Collections.Generic.IEnumerable(Of System.Int32)", testPosition:=False)
+ Await TestAsync(text, "Global.System.Collections.Generic.IEnumerable(Of System.Int32)", TestMode.Node)
End Function
@@ -771,7 +776,7 @@ class C
dim b as boolean = x.[||]
end sub
end class"
- Await TestAsync(text, "System.Boolean", testNode:=False)
+ Await TestAsync(text, "System.Boolean", TestMode.Position)
End Function
@@ -784,7 +789,7 @@ end class"
[|z|].Select
End Sub
End Module"
- Await TestAsync(text, "System.Object", testNode:=False)
+ Await TestAsync(text, "System.Object", TestMode.Position)
End Function
End Class
End Namespace