Skip to content

For tuple types, NamedTypeSymbol.GetFieldsToEmit API should return symbols for tuple underlying fields.#43552

Merged
AlekseyTs merged 3 commits intodotnet:masterfrom
AlekseyTs:Issue43524
Apr 24, 2020
Merged

For tuple types, NamedTypeSymbol.GetFieldsToEmit API should return symbols for tuple underlying fields.#43552
AlekseyTs merged 3 commits intodotnet:masterfrom
AlekseyTs:Issue43524

Conversation

@AlekseyTs
Copy link
Contributor

Fixes #43524.
Related to #43549.

@AlekseyTs
Copy link
Contributor Author

@jcouv, @dotnet/roslyn-compiler Please review

{
Debug.Assert((object)associatedField.AssociatedSymbol != null);

associatedField = associatedField.TupleUnderlyingField ?? associatedField;
Copy link
Member

Choose a reason for hiding this comment

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

This pattern pops up a bit. Is it worth adding a new member like TulpeUnderlyingFieldOrSelf to encourage this as a best practice going forward?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pattern pops up a bit. Is it worth adding a new member like TulpeUnderlyingFieldOrSelf to encourage this as a best practice going forward?

Are you suggesting to add one? I didn't get an urge to add one.

Copy link
Member

Choose a reason for hiding this comment

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

Reading the PR I was wondering to myself:

How will future developers know this is an important problem? If we had TupleUnderlyingFieldOrSelf maybe it would be a clue that this is important.

I don't feel strongly about this. It's just a thought I had reading through this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How will future developers know this is an important problem?

I guess I am not sure what is the problem to be aware of. There is an API TupleUnderlyingField, it is docummented to return null in some scenarios. What is there to miss or be confused about?

Copy link
Member

Choose a reason for hiding this comment

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

Mostly that in the case the return is null then using this is the generally the correct fallback. That can also be inferred by looking through these cases.

As I said though, this isn't a big concern. Mostly just thinking out loud as I'm reading the PR.

@AlekseyTs
Copy link
Contributor Author

@jcouv Please review

@AlekseyTs
Copy link
Contributor Author

@jcouv Please review, need a second sign-off

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

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

LGTM Thanks (iteration 3)

@jcouv jcouv self-assigned this Apr 24, 2020
@AlekseyTs AlekseyTs merged commit d38b110 into dotnet:master Apr 24, 2020
@ghost ghost added this to the Next milestone Apr 24, 2020
@sharwell sharwell modified the milestones: Next, temp, 16.7.P1 Apr 28, 2020
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.

Roslyn throws exception when compiling project

5 participants