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 methods in AnyVals #9166

Closed
scabug opened this issue Feb 20, 2015 · 5 comments
Closed

Bridge methods in AnyVals #9166

scabug opened this issue Feb 20, 2015 · 5 comments
Assignees

Comments

@scabug
Copy link

scabug commented Feb 20, 2015

I assume this is a new incarnation of #6260. Affects 2.11.5

trait XX[+This] extends Any {
  def repr: This
}

class Id[+T](val t: T) extends AnyVal with XX[Id[T]] {
  def repr = this
}

/*
[error] /Users/dlwh/src/breeze/math/src/main/scala/breeze/newindex/xx.scala:31: bridge generated for member method repr: ()breeze.newindex.Id[T] in class Id
[error] which overrides method repr: ()This in trait XX
[error] clashes with definition of the member itself;
[error] both have erased type ()Object
[error]   def repr = new Id(t)
*/
@scabug
Copy link
Author

scabug commented Feb 20, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9166?orig=1
Reporter: @dlwh
Affected Versions: 2.11.5

@scabug
Copy link
Author

scabug commented Feb 20, 2015

@dlwh said:
actually possibly this is just impossible?

@scabug
Copy link
Author

scabug commented Feb 20, 2015

@retronym said:
Yep, this is simply not possible to support. The fix for #6260 avoids the need for a bridge method in an anoynmous subclass of FunctionN by exactly implementing the interface method. But if you have a named type this isn't possible, as a client of Id#repr will expect repr to return an unboxed Id.

@scabug scabug closed this as completed Feb 20, 2015
@scabug
Copy link
Author

scabug commented Feb 20, 2015

@retronym said:
Well, it is not quite impossible: an alternative encoding for value classes in which the unboxed versions of methods had mangled names, in the same spirit as specialization would allow this.

@scabug
Copy link
Author

scabug commented Feb 20, 2015

@dlwh said:
Thanks! sorry for the noise.

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