Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More test coverage for delegate invoke with conditional access #8586

Merged
merged 4 commits into from Feb 11, 2016

Conversation

balajikris
Copy link
Member

This PR contains work done for #8309.

  • minor code clean ups
  • more tests, coverage and documenting current design via tests.

.. invocation fix/refactoring.. Notably, in cases where the code has a
local declared and if the declaration has multiple variables or if the
local is accessed outside of the invocation pattern, we do not touch the
declaration in anyway. However we still simplify the delegate invocation
pattern.
Renaming a helper, returning appropriately from a TryXXX() method etc.,
very minor code cleanups.
.. invocation fix/refactoring. Particularly around the pattern we look
for - a local, immediately followed by a check for null and invocation.
Adding some tests where the local declaration is grouped to the top and
not grouped with the pattern itself.
@balajikris
Copy link
Member Author

@CyrusNajmabadi @dotnet/roslyn-ide

.. that does not match the delegate invoke pattern we look for..
@balajikris
Copy link
Member Author

@CyrusNajmabadi : Please glance through the tests as well. I've taken the assumptions made in the code and turned them to unit tests to document current design. Such assumptions may or may not be intended, but I wouldn't know 😄 For e.g: we look for a strict pattern with removing locals -- that the declaration is in the line immediately preceding the null check and invoke pattern. If the local were grouped with other locals at the beginning of the block, we will not touch the declaration. This could be the intended design (it convincingly looks like that is the case), but there could be other cases where it wasn't really intended. So, if you find anything odd with the expectations of the unit tests I've added, Please call them out. Thanks.

@CyrusNajmabadi
Copy link
Member

👍

@balajikris
Copy link
Member Author

Test only PR. Merging.

balajikris added a commit that referenced this pull request Feb 11, 2016
More test coverage for delegate invoke with conditional access
@balajikris balajikris merged commit 38edea5 into dotnet:master Feb 11, 2016
@balajikris balajikris deleted the TestDelegateInvoke branch February 11, 2016 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants