Add nullable ref annotations to SyntaxFactory#54199
Conversation
The overloads these were calling allow for null values
|
@jcouv I'm not familiar with PR practices in this repo. Should I complete this PR at this point? |
|
@AArnott Thanks for the ping. The general rule is that every compiler PR needs two reviews (including one senior). Then we merge/squash by default to simplify git history. @dotnet/roslyn-compiler for a second review. Thanks |
|
The issue makes me wonder if there is some heuristic we could use in the IDE to determine if a parameter's non-nullability is "unnecessary". For example, if we did an additional flow analysis where we assumed that the parameter may be null, and there were no new warnings produced. |
…ures/caller-argument-expression * upstream/main: (492 commits) Add nullable ref annotations to SyntaxFactory (#54199) Add 'replace' APIs and hook them up to the IDE (#54270) Allow implicit implementation of non-public interface members (#54182) Make insertion a stage of the official build (#54376) Cleanup Remove unused property Simplify glyph computation Report all-empty top level statements. (#54385) Calculate TypeParameterKind based on the container type (#54200) vert not roaming Split tests Multple matches Report as we get results Fixup tests Update tests Avoid thread dependency in VirtualMemoryNotificationListener constructor Fast progression search. Add LanguageVersion 10 (#54359) Sure, why not ...
Shouldn't compiler expose such API e.g. through speculative semantic model, instead of having to fork the compilation and check diagnostics? |
I was thinking of the DataFlowsOut API as a precedent, where IIRC we do an extra definite assignment pass, treating assignments within the given region as unassignments, then if additional diagnostics are given as a result of those unassignments, we say that the affected variables "flow out" of the region. The diagnostics themselves aren't actually surfaced. |
The overloads these were calling allow for null values.
There are probably many more like this that I didn't happen to run into. I recommend an audit around the pattern where these bugs were found.