- Notifications
You must be signed in to change notification settings - Fork4.2k
Fix FAR counting for target-typed new#48434
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 ourterms of service andprivacy 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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| voidCollectMatchingReferences(ISymboloriginalUnreducedSymbolDefinition,SyntaxNodenode, | ||
| ISyntaxFactsServicesyntaxFacts,ISemanticFactsServicesemanticFacts,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
https://github.com/dotnet/roslyn/pull/43645/files#diff-aeace626a93e2448b1aec4bc466c9931R336-R337
I see you introduced an extension method called "IsImplicitObjectCreationExpression". So I'm not sure whether I should useIsImplicitObjectCreation instance method, orIsImplicitObjectCreationExpression, and why we need the two?
Youssef1313 left a comment
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 methodFindReferencesInImplicitObjectCreationExpressionAsync is currently inAbstractReferenceFinder.cs. I think it makes more sense to move it as a private method toConstructorSymbolReferenceFinder.cs.
I can't see a reason why to make it inAbstractReferenceFinder while its friend is inConstructorSymbolReferenceFinder:
Line 107 inbc85a40
| privatestaticValueTask<ImmutableArray<FinderLocation>>FindOrdinaryReferencesAsync( |
If you agree, I'll fix that.
Youssef1313 left a comment
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 aTask, whileFindOrdinaryReferencesAsync returns aValueTask.
I'm not sure if there is a performance benefit if both are returning aValueTask. It worth having a look.
sharwell commentedOct 8, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Blocked on#48401 that we are taking for 16.8. Keeping this PR open since the test is still helpful. |
Youssef1313 commentedOct 8, 2020
@sharwell Do I need to retarget the PR to 16.8 branch? |
sharwell commentedOct 8, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@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 youwant to retarget this to release/dev16.8 after my change merges, that would likely be acceptable as a test-only change. |
Youssef1313 commentedOct 8, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@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: |
CyrusNajmabadi commentedOct 8, 2020
Already has PR to fix in:#48402 :) |
CyrusNajmabadi left a comment
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.
Youssef1313 commentedOct 8, 2020
@CyrusNajmabadi No problem at all! Closing as duplicate. |
Youssef1313 commentedOct 10, 2020
The bug is already fixed, but I re-opened to add the test to prevent regressions while refactoring in the future. |
Youssef1313 commentedOct 10, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Youssef1313 commentedNov 4, 2020
@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 documentcontains 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.