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

Simplifier annotation not working in Visual Basic #473

Open
shyamnamboodiripad opened this issue Feb 13, 2015 · 3 comments
Open

Simplifier annotation not working in Visual Basic #473

shyamnamboodiripad opened this issue Feb 13, 2015 · 3 comments

Comments

@shyamnamboodiripad
Copy link
Contributor

Ported from TFS WorkItem: 1084695 and http://roslyn.codeplex.com/workitem/399

**sharwell* reported:

I am attempting to resolve the following issue:
DotNetAnalyzers/NullParameterCheckRefactoring#18

I attempted to use the same strategy as the C# implementation: adding the Simplifier.Annotation annotation to the top-level syntax tree which was generated and inserted as part of the refactoring. However, even with this annotation the inserted code contains a reference to System.ArgumentNullException instead of just ArgumentNullException.

Here is a link to the commit I *expected
to resolve this issue in my code:
sharwell/NullParameterCheckRefactoring@cac7241


**Manish Vasani* commented:*

This seems to be an issue related to the weirdness of how we treat Simplify/DontSimplify annotations in our simplification engine.

The underlying issue isn't difficult to fix. However, the fix causes other tests to fail, seems like other rewriters were relying on the wrong behavior of us not respecting simplify/don't simplify annotations on statement nodes. We should address this bug as part of the bigger work item to rationalize simplify annotations.

_Simplifier annotations added explicitly to statement nodes are not working in VB. This is due to special handling of statement simplification in VB. Even though we can speculate on individual statements, simplification for statements is dependent on prior and subsequent statements. Hence we execute the simplification rewriters on the entire method block enclosing the statements. However, we did not set the alwaysSimplify flag if the node has a simplifier annotation. So, if any descendant expression node has a simplifier annotation, we simplify it, but if the whole statement had the simplifier annotation, but none of it descendants were annotation, we don't simplify the entire statement.
The issue wasn't previously caught as our simplification analyzer always annotates individual expressions to simplify.


@shyamnamboodiripad shyamnamboodiripad self-assigned this Feb 13, 2015
@shyamnamboodiripad shyamnamboodiripad added this to the 1.0-rc2 milestone Feb 13, 2015
@shyamnamboodiripad shyamnamboodiripad changed the title [CodePlex] Simplifier annotation not working in Visual Basic Simplifier annotation not working in Visual Basic Feb 13, 2015
@srivatsn srivatsn modified the milestones: 1.0 (stable), 1.0-rc2 Feb 24, 2015
@shyamnamboodiripad shyamnamboodiripad modified the milestones: Unknown, 1.0 (stable) Apr 27, 2015
@shyamnamboodiripad shyamnamboodiripad removed their assignment Apr 27, 2015
@shyamnamboodiripad
Copy link
Contributor Author

Moving this out to the unknown milestone. The work involved to fix the simplifier for this issue is significant and it is unlikely that we can bite this off for v1.0. We have a story on the backlog for addressing this. I will add a link to that story here once I port that story to GitHub.

@paul1956
Copy link
Contributor

@shyamnamboodiripad Any Update on this issue now that it is on GitHub?

@shyamnamboodiripad
Copy link
Contributor Author

cc @mavasani and @srivatsn as they would probably know more about the current status for this issue and when this work is scheduled to happen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants