Skip to content
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

Tuple and underlying type unification. Part 1. #11006

Merged
merged 3 commits into from
May 3, 2016

Conversation

AlekseyTs
Copy link
Contributor

@AlekseyTs AlekseyTs commented May 1, 2016

  • Include members of underlying type into a set of members returned by
    tuple type symbol. Properties and events are not supported at the moment.
  • Track declaration locations for tuple related symbols.
  • Ensure Rest extensions are tuples.

It is probably better to review commit by commit.

- Include memebers of underlying type into a set of members returned by
tuple type symbol. Properties and events are not supported at the moment.
- Track declaration locations for tuple related symbols.
- Ensure Rest extensions are tuples.
@AlekseyTs
Copy link
Contributor Author

test prtest/lin/dbg/unit32 please

@AlekseyTs
Copy link
Contributor Author

test prtest/win/dbg/unit64 please

@AlekseyTs
Copy link
Contributor Author

test prtest/lin/dbg/unit32 please

@AlekseyTs
Copy link
Contributor Author

@AlekseyTs
Copy link
Contributor Author

@VSadov , @jcouv, @dotnet/roslyn-compiler Please review.

@jaredpar
Copy link
Member

jaredpar commented May 2, 2016

Is there a reason we are doing this in features/tuples instead of future?

/// <summary>
/// Represents a field of a tuple type (such as (int, byte).Item1)
/// that doesn't have a corresponding backing field within the tuple underlying type.
/// Created in response to an error condition.
Copy link
Member

Choose a reason for hiding this comment

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

Confused on this point. (int, byte).Item1 does have a backing field. Is there a subtle issue I'm missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure, only you can tell. :-) Perhaps you can ask a more specific question.

Copy link
Member

Choose a reason for hiding this comment

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

Does this type get instantiated for (int, byte).Item1? If so then I find the comment confusing because it has a real backing field: ValueTuple<int,byte>.Item1.


In reply to: 61766119 [](ancestors = 61766119)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is because you think we live in the perfect world. :-) However, we should be prepared that ValueTuple<,> doesn't have the Item1 field of the expected type, i.e. malformed. The comment specifically talks about an error situation. If you think it is not clear enough, please provide your wording and I will paste it in.

@AlekseyTs
Copy link
Contributor Author

@jaredpar

Is there a reason we are doing this in features/tuples instead of future?

This is where I started working. Once I have all the pieces in place, I'll merge into future.

// do not lose the original element names in the literal if different from names in the target

// PROTOTYPE(tuples): Come back to this, what about locations?
Copy link
Member

@gafter gafter May 2, 2016

Choose a reason for hiding this comment

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

If this will be targeted to the future branch, this needs to be resolved. #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not targeted to the future.

@gafter
Copy link
Member

gafter commented May 2, 2016

👍

NamedTypeSymbol currentLinkType = tupleType.UnderlyingTupleType;
if ((object)underlyingField == null)
{
// Use-site error must have been repoted elsewhere.
Copy link
Member

Choose a reason for hiding this comment

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

s/repoted/reported/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll fix in the next change.


In reply to: 61790864 [](ancestors = 61790864)

return new TupleTypeSymbol(locations, tupleCompatibleType, elementLocations, elementNames, elementTypes);
}

private static NamedTypeSymbol EnsureRestExtensionsAreTuples(NamedTypeSymbol tupleCompatibleType)
Copy link
Member

Choose a reason for hiding this comment

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

This method could use an xml doc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll try to come up with something. I encourage you to provide an example of what you would put there to make sure your specific concern, if any, is addressed.


In reply to: 61807571 [](ancestors = 61807571)

@jcouv
Copy link
Member

jcouv commented May 3, 2016

LGTM

@AlekseyTs
Copy link
Contributor Author

test prtest/lin/dbg/unit32 please

@VSadov
Copy link
Member

VSadov commented May 3, 2016

LGTM

@AlekseyTs AlekseyTs merged commit dff0320 into dotnet:features/tuples May 3, 2016
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.

None yet

6 participants