Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
55757b3
Infer type in get accessor declaration
rik-smeets May 20, 2018
e204163
Add test with expression bodied getter with a different accessibility
rik-smeets May 20, 2018
9f1646a
Use pattern matching when inferring type in arrow expression clause a…
rik-smeets May 20, 2018
f347121
Add tests for generating methods from within expression bodies getter…
rik-smeets May 20, 2018
005add1
Use pattern matching inside switch statement
rik-smeets May 20, 2018
896de85
Use pattern matching directly on parent symbol when inferring type in…
rik-smeets May 20, 2018
7f3b037
Use local function to determine symbol return type, preventing some d…
rik-smeets May 21, 2018
5b50b1c
Add tests for generating methods and variables from within local func…
rik-smeets May 21, 2018
33d2074
Pass CancellationToken to GetDeclaredSymbol and remove redundant null…
rik-smeets May 21, 2018
def52e3
Fix type inference in block bodied local functions
rik-smeets May 27, 2018
0248697
Use constants for indexes
rik-smeets May 27, 2018
56d7514
Extract local function to private method
rik-smeets May 27, 2018
37c8639
Consistent naming in all new generating variable tests
rik-smeets May 27, 2018
a53f504
Use already existing method to get member type
rik-smeets May 27, 2018
0130a24
Fix type inferrence for local function inside lambda expression
rik-smeets May 27, 2018
ae5eaf3
Remove some redundant code and use pattern matching on memberSymbol too
rik-smeets May 27, 2018
5a65f66
Merge pull request #26997 from rik-smeets/infer-type-in-expression-bo…
jinujoseph Jun 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7730,6 +7730,206 @@ static void Main(string[] args)
Console.WriteLine(arg.[|NotFound|]());
});
}
}");
}

[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenerateMethodInExpressionBodiedGetter()
{
await TestInRegularAndScriptAsync(
@"class Class
{
int Property
{
get => [|GenerateMethod|]();
}
}",
@"using System;

class Class
{
int Property
{
get => GenerateMethod();
}

private int GenerateMethod()
{
throw new NotImplementedException();
}
}");
}

[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenerateMethodInExpressionBodiedSetter()
{
await TestInRegularAndScriptAsync(
@"class Class
{
int Property
{
set => [|GenerateMethod|](value);
}
}",
@"using System;

class Class
{
int Property
{
set => GenerateMethod(value);
}

private void GenerateMethod(int value)
{
throw new NotImplementedException();
}
}");
}

[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenerateMethodInExpressionBodiedLocalFunction()
{
await TestInRegularAndScriptAsync(
@"class Class
{
void Method()
{
int Local() => [|GenerateMethod()|];
}
}",
@"using System;

class Class
{
void Method()
{
int Local() => GenerateMethod();
}

private int GenerateMethod()
{
throw new NotImplementedException();
}
}");
}

[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenerateMethodInBlockBodiedLocalFunction()
{
await TestInRegularAndScriptAsync(
@"class Class
{
void Method()
{
int Local()
{
return [|GenerateMethod()|];
}
}
}",
@"using System;

class Class
{
void Method()
{
int Local()
{
return GenerateMethod();
}
}

private int GenerateMethod()
{
throw new NotImplementedException();
}
}");
}

[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenerateMethodInBlockBodiedLocalFunctionInsideLambdaExpression()
{
await TestInRegularAndScriptAsync(
@"
using System;

class Class
{
void Method()
{
Action action = () =>
{
int Local()
{
return [|GenerateMethod()|];
}
}
}
}",
@"
using System;

class Class
{
void Method()
{
Action action = () =>
{
int Local()
{
return GenerateMethod();
}
}
}

private int GenerateMethod()
{
throw new NotImplementedException();
}
}");
}

[WorkItem(26993, "https://github.com/dotnet/roslyn/issues/26993")]
[Fact, Trait(Traits.Feature, Traits.Features.CodeActionsGenerateMethod)]
public async Task TestGenerateMethodInExpressionBodiedLocalFunctionInsideLambdaExpression()
{
await TestInRegularAndScriptAsync(
@"
using System;

class Class
{
void Method()
{
Action action = () =>
{
int Local() => [|GenerateMethod()|];
}
}
}",
@"
using System;

class Class
{
void Method()
{
Action action = () =>
{
int Local() => GenerateMethod();
}
}

private int GenerateMethod()
{
throw new NotImplementedException();
}
}");
}
}
Expand Down
Loading