Skip to content

Crash after scope extrusion in macros #8216

Closed
@nicolasstucki

Description

@nicolasstucki
// 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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions