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

compiler generating self-conflicting bridge methods for Value classes #7354

Closed
scabug opened this issue Apr 9, 2013 · 4 comments
Closed

Comments

@scabug
Copy link

scabug commented Apr 9, 2013

The following code:

import scala.math.Fractional
class Prob[N](val toN: N) extends AnyVal
object Prob {
  implicit def ProbOrdering[N](implicit N: Fractional[N]): Ordering[Prob[N]] = N.on[Prob[N]](_.toN)
}

generates the error:

bridge generated for member method apply: (x$1: org.ptflame.probability.Prob[N])x$1.toN.type forSome { val x$1: org.ptflame.probability.Prob[N] } in anonymous class $anonfun which overrides method apply: (v1: T1)R in trait Function1 clashes with definition of the member itself; both have erased type (v1: Object)Object

This code should work in the obvious fashion. If extends AnyVal is removed, the error disappears.

@scabug
Copy link
Author

scabug commented Apr 9, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7354?orig=1
Reporter: Alexander Altman (pthariensflame)
Affected Versions: 2.10.1
Duplicates #6260

@scabug
Copy link
Author

scabug commented Apr 9, 2013

@retronym said:
More minimally:

class Prob(val toN: Any) extends AnyVal
object Prob {
  (_: Prob).toN
}

@scabug
Copy link
Author

scabug commented Apr 10, 2013

Stephen Compall (s11001001) said:
Like this?

@scabug
Copy link
Author

scabug commented Apr 10, 2013

@retronym said:
Thanks, I'm merging this into #6260.

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