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 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 commented Oct 6, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6482?orig=1
Reporter: @paulp

@scabug
Copy link
Author

scabug commented Oct 6, 2012

@paulp said:
Fix pending.

@scabug
Copy link
Author

scabug commented Oct 8, 2012

@paulp said:
scala/scala#1468

@scabug
Copy link
Author

scabug commented Jan 9, 2013

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

@scabug
Copy link
Author

scabug commented Jan 22, 2013

@adriaanm said:
reopening for 2.10.1-RC1 backport

@scabug
Copy link
Author

scabug commented Jan 26, 2013

@retronym said:
scala/scala#1976

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

No branches or pull requests

2 participants