dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.96k stars 4.02k forks source link

Use Site Diagnostics are missed in tuple symbols in VB #61112

Open 333fred opened 2 years ago

333fred commented 2 years ago

https://github.com/dotnet/roslyn/blob/main/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleEventSymbol.vb#L87 https://github.com/dotnet/roslyn/blob/main/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleFieldSymbol.vb#L102 https://github.com/dotnet/roslyn/blob/main/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TupleMethodSymbol.vb#L133 https://github.com/dotnet/roslyn/blob/main/src/Compilers/VisualBasic/Portable/Symbols/Tuples/TuplePropertySymbol.vb#L115

All of these call MergeUseSiteInfo and discard the result. In the VB compiler, that method does not take use site info by ref, it returns a new copy, so all of these locations will miss any use site info that should be reported.

AlekseyTs commented 2 years ago

@333fred It looks like MergeUseSiteInfo was changed to take UseSiteInfo by ref and return a bool. Does this resolve the issue?

333fred commented 2 years ago

I left this issue open for adding test coverage. The bug itself was fixed, but we have no validation of the missing diagnostics.