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

cannot use arrays in macro-related reifies #5747

Open
scabug opened this issue May 3, 2012 · 2 comments
Open

cannot use arrays in macro-related reifies #5747

scabug opened this issue May 3, 2012 · 2 comments
Labels
Milestone

Comments

@scabug
Copy link

scabug commented May 3, 2012

import scala.reflect.makro.{Context => Ctx}

object Macros {
  def foo[T](s: String) = macro Impls.foo[T]

  object Impls {
    def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify {
      Array(s.eval)
    }
  }
}
object Test extends App {
  val arr = Macros.foo("hello", "world")
  println(arr.getClass)
}
Macros_1.scala:8: error: No ArrayTag available for T
      Array(s.eval)
           ^
one error found
@scabug
Copy link
Author

scabug commented May 3, 2012

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

@scabug
Copy link
Author

scabug commented May 3, 2012

@xeno-by said:
One cannot write [T: ArrayTag], because then it will need to come from a macro def, and macro defs cannot have context bounds, as we've seen in #5744. Even if we supported context bounds and, consequently, ArrayTag ascriptions, those would transform into free terms, which are prohibited in macro expansions.

@scabug scabug added the macros label Apr 7, 2017
@scabug scabug added this to the Backlog milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants