Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Add test for macro expansion (in Scala2) #18

Open
tanishiking opened this issue Aug 7, 2021 · 0 comments
Open

Add test for macro expansion (in Scala2) #18

tanishiking opened this issue Aug 7, 2021 · 0 comments
Labels
Scala2 Issue only with Scala2 test About testing

Comments

@tanishiking
Copy link
Owner

See: https://github.com/scala/scala/tree/2.13.x/test/files/neg/warn-unused-imports

Check if there's no warn for unused import in macro expansion tree

import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
 
object Macro {
  def f: Int = macro fImpl
  def fImpl(c: Context): c.Tree = {
    import c.universe._
 
    q"""
     import scala.util.Random
     42 // TODO randomize
    """
  }
}
class MacroClient {
  def x = Macro.f  // don't crash; but also don't warn on expansion, see scala/bug#10270 and [pos|neg]/t10270
}
@tanishiking tanishiking added Scala2 Issue only with Scala2 test About testing labels Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scala2 Issue only with Scala2 test About testing
Projects
None yet
Development

No branches or pull requests

1 participant