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
CodePrinter fails to print the expr in Typed if the tpt does not have an original #8447
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8447?orig=1 |
@retronym said: |
@paulp said: Is there some facility for translating a Type into the corresponding Tree? |
@paulp said: |
@paulp said: scala> def cdef[A: TypeTag](name: TypeName) = q"class $name(param: ${typeOf[A]})"
cdef: [A](name: reflect.runtime.universe.TypeName)(implicit evidence$1: reflect.runtime.universe.TypeTag[A])reflect.runtime.universe.ClassDef
scala> showCode(cdef[Int]("Bippy"))
res0: String = class Bippy(param)
scala> cdef[Int]("Bippy").toString
res1: String =
class Bippy extends scala.AnyRef {
<paramaccessor> private[this] val param: Int = _;
def <init>(param: Int) = {
super.<init>();
()
}
} |
@xeno-by said: |
@paulp said: |
@VladimirNik said: @retronym, can I add print.code flag to this pull request? |
@retronym said: |
running that tree through
showCode
Applying this patch:
Gives the desired output:
PS: bonus marks on this ticket for making CodePrinter available under
-Xprint
. It is important that we keep to old style printing avialable, however, so we can diff the output of this from Scala 2.10 and 2.11. So we'll need to be able to control this from the command line.The text was updated successfully, but these errors were encountered: