Skip to content

"Generate method" refactoring enabled if method name is equal to imported type.#23693

Merged
jinujoseph merged 5 commits intodotnet:masterfrom
zaytsev-victor:Fixed16975
May 10, 2018
Merged

"Generate method" refactoring enabled if method name is equal to imported type.#23693
jinujoseph merged 5 commits intodotnet:masterfrom
zaytsev-victor:Fixed16975

Conversation

@zaytsev-victor
Copy link
Copy Markdown
Contributor

Fixes #16975

Ask Mode template not completed

Customer scenario

What does the customer do to get into this situation, and why do we think this
is common enough to address for this release. (Granted, sometimes this will be
obvious "Open project, VS crashes" but in general, I need to understand how
common a scenario is)

Bugs this fixes

(either VSO or GitHub links)

Workarounds, if any

Also, why we think they are insufficient for RC vs. RC2, RC3, or RTW

Risk

This is generally a measure our how central the affected code is to adjacent
scenarios and thus how likely your fix is to destabilize a broader area of code

Performance impact

(with a brief justification for that assessment (e.g. "Low perf impact because no extra allocations/no complexity changes" vs. "Low")

Is this a regression from a previous update?

Root cause analysis

How did we miss it? What tests are we adding to guard against it in the future?

How was the bug found?

(E.g. customer reported it vs. ad hoc testing)

Test documentation updated?

If this is a new non-compiler feature or a significant improvement to an existing feature, update https://github.com/dotnet/roslyn/wiki/Manual-Testing once you know which release it is targeting.

@zaytsev-victor zaytsev-victor requested a review from a team as a code owner December 10, 2017 13:37
Friend Const BC30108 As String = "BC30108" ' error BC30108: 'Foo' is a type and cannot be used as an expression.
Friend Const BC30109 As String = "BC30109" ' error BC30109: 'Foo' is a class type and cannot be used as an expression.
Friend Const BC30110 As String = "BC30110" ' error BC30110: 'Foo' is a structure type and cannot be used as an expression.
Friend Const BC30111 As String = "BC30111" ' error BC30111: 'Foo' is an interface type and cannot be used as an expression.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking all these cases. It would have been easy to miss one.

Note: do we need a case for if 'Foo' is a delegate type?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that you added one. Awesome!

{
public void M1()
{
[|Foo|]();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fyi: Foo can't be used in the codebase. You can easily rename this to Goo though.

"Imports System
Class C
Sub Bar()
[|Foo|]()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: for VB we probably do not want to offer generate-method if you've just written Foo without parens. In that case, it's just not that likely htat you were attempting to create a method with that name, but were instead trying to reference the type.

If that's hte current behavior, great. Just please add a test. If that isn't the behavior, then we should add a check to have that behavior.

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

Thanks for the PR. I just hit this recently and it was super annoying :)

@jcouv jcouv added Community The pull request was submitted by a contributor who is not a Microsoft employee. Area-IDE labels Mar 31, 2018
@DustinCampbell
Copy link
Copy Markdown
Member

@zaytsev-victor: Could you merge in the latest master?

# Conflicts:
#	src/EditorFeatures/CSharpTest/Diagnostics/GenerateMethod/GenerateMethodTests.cs
@zaytsev-victor
Copy link
Copy Markdown
Contributor Author

@DustinCampbell done.

@jinujoseph
Copy link
Copy Markdown
Contributor

@dotnet-bot Test this please

@jinujoseph
Copy link
Copy Markdown
Contributor

test windows_debug_vs-integration_prtest

@jinujoseph jinujoseph added this to the 15.8 milestone May 10, 2018
@jinujoseph jinujoseph merged commit 119aec2 into dotnet:master May 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved to merge Area-IDE Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactoring "Generate method" not suggested.

5 participants