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 implementation rejects implicit operators #11530

Closed
gafter opened this issue May 24, 2016 · 3 comments
Closed

Tuple implementation rejects implicit operators #11530

gafter opened this issue May 24, 2016 · 3 comments
Assignees
Labels
Area-Compilers Bug New Language Feature - Tuples Tuples Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Milestone

Comments

@gafter
Copy link
Member

gafter commented May 24, 2016

The following code is improperly rejected by the tuple implementation

namespace System
{
    public struct ValueTuple<T1, T2>
    {
        public T1 Item1;
        public T2 Item2;

        // error: conversion must convert to or from enclosing type
        public static implicit operator Collections.Generic.KeyValuePair<T1, T2>(ValueTuple<T1, T2> tuple)
        {
            T1 k;
            T2 v;
            (k, v) = tuple;
            return new KeyValuePair<T1, T2>(k, v);
        }

        // error: conversion must convert to or from enclosing type
        public static implicit operator ValueTuple<T1, T2>(Collections.Generic.KeyValuePair<T1, T2> kvp)
        {
            return (kvp.Key, kvp.Value);
        }
    }
}

This was tested against https://github.com/jcouv/roslyn/tree/tuple-deconstruction (from #11457) at commit jcouv@c7b60a4

@AlekseyTs
Copy link
Contributor

@gafter Could you confirm that you have #11328 merged when you see the errors?

@jcouv
Copy link
Member

jcouv commented May 24, 2016

You may want to try those tests in the future branch, which has the latest tuple code.
Only deconstruction-specific tests make sense in the features/tuples branch at this point.

@gafter
Copy link
Member Author

gafter commented May 24, 2016

@AlekseyTs I am no longer working on the branch from which I reported this. I've identified the specific branch that I was testing. You are welcome to verify whether or not that branch contains #11328.

@VSadov VSadov added this to the 2.0 (Preview 1) milestone Jun 11, 2016
@gafter gafter modified the milestones: 2.0 (Preview 1), 2.0 (RC) Jun 20, 2016
@jaredpar jaredpar modified the milestones: 2.0 (RC), 2.0 (RTM) Jul 18, 2016
@AlekseyTs AlekseyTs assigned AlekseyTs and unassigned jcouv Sep 15, 2016
@AlekseyTs AlekseyTs added 4 - In Review A fix for the issue is submitted for review. and removed 3 - Working labels Sep 16, 2016
AlekseyTs added a commit to AlekseyTs/roslyn that referenced this issue Sep 20, 2016
@AlekseyTs AlekseyTs added the Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented label Sep 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug New Language Feature - Tuples Tuples Resolution-Fixed The bug has been fixed and/or the requested behavior has been implemented
Projects
None yet
Development

No branches or pull requests

5 participants