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

value classes lose type parameter bounds #6482

Closed
scabug opened this issue Oct 6, 2012 · 6 comments
Closed

value classes lose type parameter bounds #6482

scabug opened this issue Oct 6, 2012 · 6 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Oct 6, 2012

The following class compiles without "extends AnyVal", but with it:

final class TraversableOnceOps[+A](val collection: TraversableOnce[A]) extends AnyVal {
  def reduceLeftOption[B >: A](op: (B, A) => B): Option[B] =
    if (collection.isEmpty) None else Some(collection.reduceLeft[B](op))
}
// error: type arguments [B] do not conform to method reduceLeft's type parameter bounds [B >: A]
//            if (collection.isEmpty) None else Some(collection.reduceLeft[B](op))
//                                                                        ^

This is similar to #6034 and will be fixed in the same spot, with more attention to the handling of method type parameters when synthesizing the extension methods.

@scabug
Copy link
Author

@scabug scabug commented Oct 6, 2012

Loading

@scabug
Copy link
Author

@scabug scabug commented Oct 6, 2012

@paulp said:
Fix pending.

Loading

@scabug
Copy link
Author

@scabug scabug commented Oct 8, 2012

Loading

@scabug
Copy link
Author

@scabug scabug commented Jan 9, 2013

@retronym said:
Fixed by: scala/scala#1468

Loading

@scabug
Copy link
Author

@scabug scabug commented Jan 22, 2013

@adriaanm said:
reopening for 2.10.1-RC1 backport

Loading

@scabug
Copy link
Author

@scabug scabug commented Jan 26, 2013

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants