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

macro defs effectively cannot have context bounds #5744

Closed
scabug opened this issue May 3, 2012 · 7 comments
Closed

macro defs effectively cannot have context bounds #5744

scabug opened this issue May 3, 2012 · 7 comments
Assignees
Milestone

Comments

@scabug
Copy link

@scabug scabug commented May 3, 2012

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

object Impls {
  def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = {
    import c.mirror._
    val plusOne = Apply(Select(evidence.tree, newTermName("plus")), List(x.tree, Literal(Constant(1))))
    val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(plusOne))
    Expr[Unit](body)
  }
}
object Test extends App {
  def foo[U: Numeric](x: U) = macro Impls.foo[U]
  foo(42)
}
Macros_Test_2.scala:2: error: macro implementation has wrong shape:
 required: (c: scala.reflect.makro.Context)(x: c.Expr[U])(evidence$1: c.Expr[Numeric[U]]): c.Expr[Unit]
 found   : (c: scala.reflect.makro.Context)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]): c.Expr[Unit]
parameter names differ: evidence$1 != evidence
  def foo[U: Numeric](x: U) = macro Impls.foo[U]
                                             ^
one error found
@scabug
Copy link
Author

@scabug scabug commented May 3, 2012

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

@scabug
Copy link
Author

@scabug scabug commented May 3, 2012

@xeno-by said:
Synthetic evidence ValDefs should be marked as SYNTHETIC. In that case macro def <-> macro impl correspondence checker will ignore the names.

@scabug
Copy link
Author

@scabug scabug commented Dec 4, 2012

@xeno-by said:
This issue is being fixed.

@scabug
Copy link
Author

@scabug scabug commented Feb 7, 2013

@scabug
Copy link
Author

@scabug scabug commented Feb 8, 2013

@JamesIry said:
superseded by scala/scala#2086

@scabug
Copy link
Author

@scabug scabug commented May 20, 2013

@JamesIry said:
2.10.2 is about to be cut. Kicking down the road and un-assigning to foster work stealing.

@scabug
Copy link
Author

@scabug scabug commented Nov 21, 2013

@retronym said:
I believe that we forgot to close this ticket for 2.10.2; doing so now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants