Skip to content

Conversation

CyrusNajmabadi
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi commented Jun 17, 2025

This is the first in several refactorings. This just gets us on the same base set of shared source projects so that these legacy libraries don't need to ship their own copies of things.

Note: this only pulls in:

  <Import Project="..\..\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems" Label="Shared" />
  <Import Project="..\..\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems" Label="Shared" />
  <Import Project="..\..\Dependencies\Threading\Microsoft.CodeAnalysis.Threading.projitems" Label="Shared" />
  <Import Project="..\..\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems" Label="Shared" />

It doesn't pull in our shared symbol extensions and whatnot yet. that's a followup. this keeps the size/scope of this PR low enough.

@CyrusNajmabadi CyrusNajmabadi marked this pull request as ready for review June 18, 2025 00:40
<Import Project="..\..\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems" Label="Shared" />
<Import Project="..\..\Dependencies\PooledObjects\Microsoft.CodeAnalysis.PooledObjects.projitems" Label="Shared" />
<Import Project="..\..\Dependencies\Threading\Microsoft.CodeAnalysis.Threading.projitems" Label="Shared" />
<Import Project="..\..\Dependencies\Contracts\Microsoft.CodeAnalysis.Contracts.projitems" Label="Shared" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this will be repeated in a lot of projects. it would make a lot more sense if all these analyzers had a shared dll they depended on that could pull these in once. that's a change for the future.

ValidateApiList(additionalFiles, publicApiMap, shippedData.ApiList, isPublic, errors);
ValidateApiList(additionalFiles, publicApiMap, unshippedData.ApiList, isPublic, errors);
publicApiMap.Free();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the helper that made this possible was used only here. i felt it better to just remove it than keep it around.

@@ -285,7 +285,8 @@ or RoslynDiagnosticIds.ObliviousPublicApiRuleId
}
}

var symbolNamesToRemove = symbolNamesToRemoveBuilder.ToImmutableAndFree();
var symbolNamesToRemove = symbolNamesToRemoveBuilder.ToImmutableHashSet();
symbolNamesToRemoveBuilder.Free();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was an odd case i couldn't keep working. so i just inlined as well as pulling in the extensions caused too many conflicts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I was going to ask. =)

@@ -171,7 +171,7 @@ internal ValueContentAbstractValue Merge(ValueContentAbstractValue otherState)
throw new ArgumentNullException(nameof(otherState));
}

ImmutableHashSet<object?> mergedLiteralValues = LiteralValues.AddRange(otherState.LiteralValues);
ImmutableHashSet<object?> mergedLiteralValues = ImmutableHashSetExtensions.AddRange(LiteralValues, otherState.LiteralValues);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you use any semantic search to find opportunities like this or are you just scouring code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants