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

Confusing error message on macro implementation shape mismatch #7923

Closed
scabug opened this issue Oct 19, 2013 · 1 comment
Closed

Confusing error message on macro implementation shape mismatch #7923

scabug opened this issue Oct 19, 2013 · 1 comment
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Oct 19, 2013

Error message on the wrong shape of macro definition like:

import scala.reflect.macros.Context
import scala.language.experimental.macros
object muuu {
  def apply() = macro impl
  def impl(c: Context): c.Tree = ???
}

That currently looks like:

test.scala:4: error: macro implementation has wrong shape:
 required: (c: scala.reflect.macros.Context)(): c.Expr[Any]
 found   : (c: scala.reflect.macros.Context): c.Tree
number of parameter sections differ
  def apply() = macro impl
      ^
one error found

Is a bit confusing because c.Tree is indeed a legal return type, you don't have to wrap everything into c.Expr any more. (The real problem here is mismatch between shapes of the arguments lists.)

@scabug
Copy link
Author

scabug commented Oct 19, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7923?orig=1
Reporter: @densh
Affected Versions: 2.11.0-M6

@scabug scabug closed this as completed Dec 11, 2013
@scabug scabug added the macros label Apr 7, 2017
@scabug scabug added this to the 2.11.0-M8 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