Skip to content

Crash after scope extrusion in macros #8216

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
nicolasstucki opened this issue Feb 5, 2020 · 0 comments · Fixed by #11442
Closed

Crash after scope extrusion in macros #8216

nicolasstucki opened this issue Feb 5, 2020 · 0 comments · Fixed by #11442
Assignees
Milestone

Comments

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Feb 5, 2020

// Macro_1.scala

package macros
import scala.quoted._

var saved = Option.empty[Expr[Any]]

def oops(c: Expr[Any])(using QuoteContext) = {
  if saved.isEmpty then
    saved = Some(c)
    c
  else saved.get
}
inline def test(c: Any) = ${oops('c)}
// Test_2.scala

object Test {
  class A(x: Int) {
    macros.test(x)
  }
  class B(y: String) {
    macros.test(y)
  }
}

Originally posted by @LPTK in #7142 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants