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

reify does not respect aliases #6005

Closed
scabug opened this issue Jun 29, 2012 · 5 comments
Closed

reify does not respect aliases #6005

scabug opened this issue Jun 29, 2012 · 5 comments

Comments

@scabug
Copy link

scabug commented Jun 29, 2012

Reify dealiases symbols and types being reified. This is philosophically incorrect, but, more importantly, produces utterly confusing results with the advent of reflection:

import scala.reflect.runtime.universe._

trait A[X]
trait B[Y] extends A[Y]
trait D
trait E extends A[D]
trait F extends A[String]

object Test extends App {
  val atype = typeOf[A[String]]
  val atype2 = typeOf[F].parents(1)
  println(typeOf[F].parents contains atype)
  println(typeOf[F].parents contains atype2)
}
@scabug
Copy link
Author

scabug commented Jun 29, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6005?orig=1
Reporter: @xeno-by
Affected Versions: 2.10.0

@scabug
Copy link
Author

scabug commented Jun 30, 2012

@paulp said:
This ticket is confusing, because I see no aliases. I do see some confusing results - atype and atype2 have the same symbol id but compare unequal. That's not a consequence of dealiasing. Since it is a phenomenon with which I am unfamiliar, it must be mirror/classloader/universe-related. Right?

@scabug
Copy link
Author

scabug commented Jun 30, 2012

@paulp said:
Ohhhh, maybe String is the alias in question. I tend to forget that's an alias.

@scabug
Copy link
Author

scabug commented Jun 30, 2012

@xeno-by said:
Yeah. typeOf uses reify under the covers and that converts Predef.String to java.lang.String, whereas parents contain verbatim Predef.String.

@scabug
Copy link
Author

scabug commented Jul 3, 2012

@xeno-by said:
Fixed in scala/scala@96dd731

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