Skip to content

Unintuitive malformed macro error and IFT #5840

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

Closed
biboudis opened this issue Feb 4, 2019 · 1 comment
Closed

Unintuitive malformed macro error and IFT #5840

biboudis opened this issue Feb 4, 2019 · 1 comment

Comments

@biboudis
Copy link
Contributor

biboudis commented Feb 4, 2019

Refactoring an inline method like i5_1, into i5_2 seems natural. Since the RHS is a complex block this is not permitted.

object Test {
  case class Ctx()
  type Contextual[T] = given Ctx => T
  inline def i5_1[T](n: T)(implicit thisCtx: Ctx): T = ${ 'n } // OK
  inline def i5_2[T](n: T): Contextual[T] = ${ println(); 'n } // error: malformed macro
}

What would be better: to let it pass it through or just improve the error message?

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Feb 4, 2019

The issue is probably that i5_2 is expanded to

  inline def i5_2[T](n: T): Contextual[T] = (x$1: Ctx) |=> ~{ '(n) }

which we do not handle

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 4, 2019
Also me more precise on the position where a macro is malformed.
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Jul 4, 2019
Also me more precise on the position where a macro is malformed.
nicolasstucki added a commit that referenced this issue Jul 4, 2019
Fix #5840: Give more informative error message
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