-
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
Handle unspecified anonymous type property in VisualBasicOperationFactory #74091
Conversation
1f69f76
to
6723d45
Compare
Dim item = New C() With {.} | ||
~ | ||
]]>.Value | ||
Dim expectedFlowGraph = <![CDATA[ |
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.
Dim [property] As IPropertySymbol = DirectCast(boundAnonymousTypePropertyAccess.ExpressionSymbol, IPropertySymbol) | ||
Return CreateBoundAnonymousTypePropertyAccessOperation(boundAnonymousTypePropertyAccess, [property]) |
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.
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.
I tried that initially. However, TestOperationVisitor.VisitAnonymousObjectCreation()
expects the initializer target to be an IPropertyReferenceOperation
, and I assumed there might be consumers other than test code that also expect the same.
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.
I think we should simply change the assertion in TestOperationVisitor.VisitAnonymousObjectCreation
, what it is doing is mostly driven by implementation. When we are fixing bugs, we are changing shape of IOperation
tree even for success scenarios, not to mention error scenarios. The binder says, it doesn't know what the property is (that is what the bound node returns) and I think we should stick with that rather than trying to re-guess what that property might be. Otherwise, we probably should fix what the bound node returns, so that SemanticModel
and IOperation
tree produce consistent result.
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. Based on our offline discussion, I've left this as is, and added a check of the SemanticModel to the tests.
Done with review pass (commit 1) |
Initializers(1): | ||
ISimpleAssignmentOperation (OperationKind.SimpleAssignment, Type: ?, IsInvalid) (Syntax: '.') | ||
Left: | ||
IPropertyReferenceOperation: Property <anonymous type: $0 As ?>.$0 As ? (OperationKind.PropertyReference, Type: ?, IsInvalid) (Syntax: '') |
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.
Done with review pass (commit 3) |
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.
LGTM (commit 4)
Handle unspecified anonymous type property in
VisualBasicOperationFactory
.https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2063559