Open RikkiGibson opened 2 years ago
I would be interested in doing a spike to see:
I think that language design input may be needed in order to make this change.
@ryzngard does "change var to explicit type" work as expected now even though we didn't make the change suggested in this issue?
does "change var to explicit type" work as expected now
The tracking issue https://github.com/dotnet/roslyn/issues/41243 is still open.
I think this could be done using the infrastructure we already have to reinfer the nullability of type arguments during flow analysis. In the compiler layer the local symbol would always have an annotated type, but in public API it could have whatever best type we determined through flow analysis.
I don't think this would be more expensive, because we already have to do a nullable analysis when you query about things inside a method body with nullable enabled.
Originally posted by @RikkiGibson in https://github.com/dotnet/roslyn/issues/57974#issuecomment-1005062560
Related to #41245