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

"bridge generated for member value … clashes with definition of the member itself" #10118

Closed
scabug opened this issue Dec 22, 2016 · 2 comments
Assignees

Comments

@scabug
Copy link

scabug commented Dec 22, 2016

I've seen SI-8702 and friends, but feel like I'm hitting the same issue with an even simpler use-case.

Is it possible (in Scala 2.10) to have abstract members whose type is a value-class?

class Foo(val n: Int) extends AnyVal

trait Bar { def foo: Foo }

case class Baz(foo: Foo) extends Bar

<console>:9: error: bridge generated for member value foo: ()Foo in class Baz
which overrides value foo: ()Foo in trait Bar
clashes with definition of the member itself;
both have erased type ()Int
       case class Baz(foo: Foo) extends Bar
                      ^
@scabug
Copy link
Author

scabug commented Dec 22, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10118?orig=1
Reporter: Ryan Williams (rdub)
Affected Versions: 2.10.6
See #8702

@scabug
Copy link
Author

scabug commented Dec 22, 2016

@retronym said:
The problem here is an over-eager restriction, there is no fundamental reason that the compiler should not allow this. We fixed this in Scala 2.11 only, scala/scala#3082, so if you're stuck on 2.10, you might need to use a workaround. One such workaround would be to pass a parameter of type Some[Foo], rather than Foo, which effectively disables the value class optimization for that method signature.

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