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

TypeInfo.ConvertedType.NullableAnnotation is None when binding a 'var' keyword #40052

Closed
jasonmalinowski opened this issue Nov 28, 2019 · 3 comments
Labels
Area-Compilers Bug Feature - Nullable Reference Types Nullable Reference Types Feature - Nullable Semantic Model Nullable Semantic Model Issues Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@jasonmalinowski
Copy link
Member

This is being observed in #40030 as I'm removing the IDE's nullable wrappers. If you run this test in the branch it fails. The test is calling GetTypeInfo on the argument and grabbing the ConvertedType here. The old nullability APIs say that it is indeed nullable, but the new ITypeSymbol.NullableAnnotation still says None.

I believe the expectation now is the ITypeSymbol.NullableAnnotation should have brought along the annotated state of Annotated.

@AlekseyTs
Copy link
Contributor

@jasonmalinowski Could you please clearly describe the issue in following terms?

  • Here is a source
  • On this node/token an API is called (which API)
  • Here is the result
  • Here is what expected.

@jasonmalinowski
Copy link
Member Author

jasonmalinowski commented Dec 12, 2019

If you look at this test, the highlighted span is the code. The [||] is the marker where we invoke the refactoring if you wanted to actually try that, otherwise delete the marker. If we call GetTypeInfo on the "var" keyword, the TypeInfo has ConvertedNullability property saying it's annotated as "string?", but the ITypeSymbol given by the ConvertedType property has a NullableAnnotation of "none". The expectation in this case would be it carries along the nullability.

If I recall, if you set a breakpoint at this line in my pull request, and run the test, the breakpoint will hit easily and you can inspect the result in that case.

@jaredpar jaredpar added the Bug label Dec 14, 2019
@jaredpar jaredpar added this to the 16.5 milestone Dec 14, 2019
@AlekseyTs
Copy link
Contributor

I believe this issue should be fixed by #40338.

@AlekseyTs AlekseyTs removed their assignment Dec 23, 2019
@AlekseyTs AlekseyTs added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Feature - Nullable Reference Types Nullable Reference Types Feature - Nullable Semantic Model Nullable Semantic Model Issues Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

4 participants