Use member type for relational pattern even in error cases#51950
Use member type for relational pattern even in error cases#51950cston merged 3 commits intodotnet:mainfrom
Conversation
| { | ||
| FieldSymbol field => field.Type, | ||
| PropertySymbol property => property.Type, | ||
| _ => CreateErrorType() |
There was a problem hiding this comment.
CreateErrorType() [](start = 21, length = 17)
If this was causing a problem, is it still safe to use it for null result? #Closed
There was a problem hiding this comment.
If this was causing a problem, is it still safe to use it for null result?
The problem was caused by an error type being used when the field or property type was available. In particular, the type returned from this method should match the type used for the recursive property in MakeTestsAndBindingsForRecursivePattern(), which it should now.
In reply to: 597135186 [](ancestors = 597135186)
| { | ||
| FieldSymbol field => field.Type, | ||
| PropertySymbol property => property.Type, | ||
| _ => CreateErrorType() |
There was a problem hiding this comment.
_ [](start = 16, length = 1)
It looks like there is a possible behavior change around other kinds of symbols. If other kinds not possible, consider explicitly checking for null and throwing for everything else. #Closed
There was a problem hiding this comment.
It looks like there is a possible behavior change around other kinds of symbols.
There shouldn't be any change for other symbol kinds. BindPropertyPatternMember() sets hasErrors for symbols other than fields or properties and previously we used CreateErrorType() if hasErrors was set.
In reply to: 597137302 [](ancestors = 597137302)
|
Done with review pass (commit 2) #Closed |
|
@dotnet/roslyn-compiler, please review, thanks. |
* upstream/main: (75 commits) Split BoundInterpolatedString into BoundInterpolatedString and BoundUnconvertedInterpolatedString (dotnet#52061) Combine VB comparers into one, and combine VB and C# comparers together (dotnet#51834) Use OptimizedVSCompletionList in LSP scenarios. F5 Hot Reload (dotnet#52101) Fix typescript shim Add tests for lazy syntax trees coming from the GeneratorDriver React to code review feedback. Simplify the lazy-initalization pattern used in GetRoot Remove an unnecessary override. (dotnet#52140) Update issue number (dotnet#52130) Enable CodeActions support for XAML using its own provider and CodeActionCache. The handlers are actually shared with Roslyn as is. (dotnet#52129) Add RestrictedIVT to dotnet watch to Features (dotnet#52087) Don't try to highlight operators (dotnet#52041) Use `null` instead of empty signature helps in LSP Use member type for relational pattern even in error cases (dotnet#51950) Update src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Extensions/SymbolExtensions.cs Use new QuickInfoUtilities helper Rebuild API shape (dotnet#52079) Added position parameter name Updated XAML QuickInfo to show more info like C# by using ISymbolDisplayService and adding more documentation parts. ...
Fixes #51936