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

recursive bounds do not work (a.k.a., f-bounded polymorphism) #2355

Closed
nikomatsakis opened this Issue May 4, 2012 · 6 comments

Comments

Projects
None yet
4 participants
@nikomatsakis
Contributor

nikomatsakis commented May 4, 2012

The following fails:

iface foo<A> { }
fn bar(A: foo<A>) { ... }

Weird as it looks there are good use cases for this. We should support it. IIRC, the code almost does it right, or maybe even does it right, if the name resolution were patched up properly.

@ghost ghost assigned nikomatsakis May 17, 2012

@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix May 2, 2013

Member

@nikomatsakis So, obviously your example is using out-dated syntax, but just to be clear:

You're talking about bounds on a type-parameter, not on a value-parameter, right?

I.e. I would write your example as something like:

trait foo<A> { }

fn bar<A : foo<A> >(_x: A) { /* ... */ }
Member

pnkfelix commented May 2, 2013

@nikomatsakis So, obviously your example is using out-dated syntax, but just to be clear:

You're talking about bounds on a type-parameter, not on a value-parameter, right?

I.e. I would write your example as something like:

trait foo<A> { }

fn bar<A : foo<A> >(_x: A) { /* ... */ }
@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix May 2, 2013

Member

Also, the trivial form I give above compiles; so I'll try to come up with a real-world use case of f-bounded polymorphism just to double-check that this bug is still a real problem.

Member

pnkfelix commented May 2, 2013

Also, the trivial form I give above compiles; so I'll try to come up with a real-world use case of f-bounded polymorphism just to double-check that this bug is still a real problem.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis May 2, 2013

Contributor

it's very possible that it works now

Contributor

nikomatsakis commented May 2, 2013

it's very possible that it works now

@alexcrichton

This comment has been minimized.

Show comment
Hide comment
@alexcrichton

alexcrichton Jul 17, 2013

Member

Visiting for triage, I agree that this compiles today. It sounds like we're not sure what an example test case of this would be, so I'm going to close for now and this can be re-opened if a test case comes up. Feel free to also reopen if you think there's more to do!

Member

alexcrichton commented Jul 17, 2013

Visiting for triage, I agree that this compiles today. It sounds like we're not sure what an example test case of this would be, so I'm going to close for now and this can be re-opened if a test case comes up. Feel free to also reopen if you think there's more to do!

@cmr cmr reopened this Jul 17, 2013

@cmr

This comment has been minimized.

Show comment
Hide comment
@cmr

cmr Jul 17, 2013

Member

Needs a test in the suite before it should be closed.

Member

cmr commented Jul 17, 2013

Needs a test in the suite before it should be closed.

@ghost ghost assigned pnkfelix Jul 17, 2013

@pnkfelix

This comment has been minimized.

Show comment
Hide comment
@pnkfelix

pnkfelix Jul 17, 2013

Member

reassigning to self so that I remember to make a test

Member

pnkfelix commented Jul 17, 2013

reassigning to self so that I remember to make a test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment