Move to the use site tracking for the purpose of recording used assemblies in VB#40640
Conversation
86fc258 to
f4e6b3b
Compare
| } | ||
| } | ||
|
|
||
| // PROTOTYPE(UsedAssemblyReferences): Mesure performace impact of collecting more information during binding by using this class. |
There was a problem hiding this comment.
Mesure [](start = 42, length = 6)
misspelled. #Resolved
| return hashSet == null || hashSet.Count == 0; | ||
| } | ||
|
|
||
| internal static bool IsNullOrEmpty<T>([NotNullWhen(returnValue: false)] this IReadOnlyCollection<T>? hashSet) |
There was a problem hiding this comment.
hashSet [](start = 109, length = 7)
please select a more apropos name. #Resolved
| { | ||
| internal static class CollectionsExtensions | ||
| { | ||
| internal static bool IsNullOrEmpty<T>([NotNullWhen(returnValue: false)] this ICollection<T>? hashSet) |
There was a problem hiding this comment.
hashSet [](start = 101, length = 7)
please select a more apropos name. #Resolved
| End If | ||
| End Sub | ||
|
|
||
| <Extension()> |
There was a problem hiding this comment.
() [](start = 14, length = 2)
Please drop the () (or add them everywhere else).
There was a problem hiding this comment.
Please drop the () (or add them everywhere else).
This doesn't violate any rules or guidelines.
In reply to: 362283395 [](ancestors = 362283395)
There was a problem hiding this comment.
Writing code in an internally inconsistent style is a bad programming practice. I am not reviewing only for things we have explicit rules for. I am reviewing for poor programming practices, among other things.
In any case, the "rule or guideline" violated here is in https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md which is referenced by https://github.com/dotnet/roslyn/blob/master/CONTRIBUTING.md and which states
When editing files, keep new code and changes consistent with the style in the files.
In reply to: 362283849 [](ancestors = 362283849,362283395)
| ' STMT: this.builder.AwaitUnsafeOnCompleted(Of TAwaiter,TSM)((ByRef) $awaiterTemp, (ByRef) Me) | ||
| ' or | ||
| ' STMT: this.builder.AwaitOnCompleted(Of TAwaiter,TSM)((ByRef) $awaiterTemp, (ByRef) Me) | ||
| Dim useSiteInfo As CompoundUseSiteInfo(Of AssemblySymbol) = Nothing |
There was a problem hiding this comment.
Dim [](start = 24, length = 3)
Is this intended to be a bug fix? If so, do we have a test for it? If yes, please identify that test. #Closed
There was a problem hiding this comment.
Is this intended to be a bug fix? If so, do we have a test for it? If yes, please identify that test.
This is intended as a change to follow a long standing requirement to report use-site errors for all operations/symbols that might have it. We don't have a test for this particular change and I do not believe it is worth spending time coming up with specific scenario demonstrating the problem. It is always safe to report use-site errors, at worse this can lead to a duplicate diagnostic being reported. If you prefer, I can undo the change and open an issue instead.
In reply to: 362285747 [](ancestors = 362285747)
There was a problem hiding this comment.
|
@dotnet/roslyn-compiler, @333fred Please review, need a second sign-off |
1 similar comment
|
@dotnet/roslyn-compiler, @333fred Please review, need a second sign-off |
| } | ||
| } | ||
|
|
||
| // PROTOTYPE(UsedAssemblyReferences): Mesure performace impact of collecting more information during binding by using this class. |
There was a problem hiding this comment.
performace [](start = 49, length = 10)
Also misspelled :) #Resolved
| } | ||
| } | ||
|
|
||
| internal void AddDependencies(IReadOnlyCollection<TAssemblySymbol>? dependencies) |
There was a problem hiding this comment.
Consider unifying this and the one above it with an AddDependencies(IEnumerable<TAssemblySymbol>? dependencies) #Closed
There was a problem hiding this comment.
Actually, I suppose you can't because you need to know how many elements are in it. It's a shame that ICollection doesn't implement IReadonlyCollection.
In reply to: 362668093 [](ancestors = 362668093)
|
|
||
| public void MergeDependencies(ref TAssemblySymbol? primaryDependency, ref ImmutableHashSet<TAssemblySymbol>? secondaryDependencies) | ||
| { | ||
| secondaryDependencies = (secondaryDependencies ?? ImmutableHashSet<TAssemblySymbol>.Empty).Union(SecondaryDependencies ?? ImmutableHashSet<TAssemblySymbol>.Empty); |
There was a problem hiding this comment.
Is this the cause of the added Linq using above? #Resolved
There was a problem hiding this comment.
If so, this could cause enumerator allocations as it won't use the struct-based enumerator on ImmutableHashSet
In reply to: 362669134 [](ancestors = 362669134)
There was a problem hiding this comment.
Is this the cause of the added Linq using above?
No, this Union method is defined on ImmutableHashSet. I assume it should be very efficient when both sides are ImmutableHashSets
In reply to: 362669358 [](ancestors = 362669358,362669134)
|
|
||
| if (!object.Equals(primaryDependency, PrimaryDependency) && PrimaryDependency is object) | ||
| { | ||
| secondaryDependencies = secondaryDependencies.Add(PrimaryDependency); |
There was a problem hiding this comment.
The docs indicate this will be empty if DiagnosticInfo is an error. Should we be conditioning that here? #Resolved
There was a problem hiding this comment.
The docs indicate this will be empty if DiagnosticInfo is an error. Should we be conditioning that here?
I do not think this needs an explicit check because PrimaryDependency would be null in that case.
In reply to: 362669608 [](ancestors = 362669608)
| else | ||
| { | ||
| Debug.Assert(info.DiagnosticInfo == null || addDependencies); // It would be strange to drop diagnostics, but record dependencies | ||
| Debug.Assert(info.DiagnosticInfo == null); // It would be strange to drop diagnostics, but record dependencies |
There was a problem hiding this comment.
// It would be strange to drop diagnostics, but record dependencies [](start = 59, length = 67)
Is this comment relevant anymore? #Resolved
There was a problem hiding this comment.
|
|
||
| Namespace Microsoft.CodeAnalysis.VisualBasic | ||
|
|
||
| ' PROTOTYPE(UsedAssemblyReferences) Consider if it makes sense to move this type into its own file |
There was a problem hiding this comment.
Leaving off review (commit 1). Will pick back up tomorrow. #Closed
This change is continuing work started in #40560. It makes similar changes on VB side.