-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FAR counting for target-typed new #48434
Fix FAR counting for target-typed new #48434
Conversation
@@ -637,6 +637,11 @@ static bool IsRelevantDocument(SyntaxTreeIndex syntaxTreeInfo) | |||
void CollectMatchingReferences(ISymbol originalUnreducedSymbolDefinition, SyntaxNode node, | |||
ISyntaxFactsService syntaxFacts, ISemanticFactsService semanticFacts, ArrayBuilder<FinderLocation> locations) | |||
{ | |||
if (syntaxFacts.IsImplicitObjectCreation(node)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcouv In
I see you introduced an extension method called "IsImplicitObjectCreationExpression". So I'm not sure whether I should use IsImplicitObjectCreation
instance method, or IsImplicitObjectCreationExpression
, and why we need the two?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method FindReferencesInImplicitObjectCreationExpressionAsync
is currently in AbstractReferenceFinder.cs
. I think it makes more sense to move it as a private method to ConstructorSymbolReferenceFinder.cs
.
I can't see a reason why to make it in AbstractReferenceFinder
while its friend is in ConstructorSymbolReferenceFinder
:
Line 107 in bc85a40
private static ValueTask<ImmutableArray<FinderLocation>> FindOrdinaryReferencesAsync( |
If you agree, I'll fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note 2:
FindReferencesInImplicitObjectCreationExpressionAsync
currently returns a Task
, while FindOrdinaryReferencesAsync
returns a ValueTask
.
I'm not sure if there is a performance benefit if both are returning a ValueTask
. It worth having a look.
Blocked on #48401 that we are taking for 16.8. Keeping this PR open since the test is still helpful. |
@sharwell Do I need to retarget the PR to 16.8 branch? |
@Youssef1313 No we can keep the test in the master branch. I was fixing a performance issue for 16.8 and it just happens to have the same root cause as this. However, if you want to retarget this to release/dev16.8 after my change merges, that would likely be acceptable as a test-only change. |
@sharwell Thanks. I'm keeping it in master. There does seem to be test failures here related to the FAR feature. Can you please re-run the failed job to see whether it's a consistent failure or just flaky? (I'd be surprised if it's a consistent failure because these tests didn't fail in your PR) I can't currently debug this because of some weird errors I'm getting in Visual Studio: I tried to restart Visual Studio a couple of times, but every time I just get a different weird error like: |
Already has PR to fix in: #48402 :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, however this is something Sam and I already have fixes for. #48402
Sorry for any time wasted.
@CyrusNajmabadi No problem at all! Closing as duplicate. |
The bug is already fixed, but I re-opened to add the test to prevent regressions while refactoring in the future. |
@CyrusNajmabadi This is a test only change. Can you please review? |
This has been reduced to a test-only change
Fixes #47987
Counting implicit object creations was depending on whether the whole document contains any implicit object creations or not.
That caused normal object creations to count as implicit when the document contains implicit creations. So, the normal object creations were counted twice.