summaryrefslogtreecommitdiff
path: root/test/files/neg/warn-unused-imports/sample_1.scala
blob: eea4d0eb4c512a517c64aea2ea3e242c9b75043a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import language._

object Sample {
  trait X
  trait Y

  // import of the non-implicit should be unused
  object Implicits {
    def `int to X`(i: Int): X = null
    implicit def `int to Y`(i: Int): Y = null
    implicit def useless(i: Int): String = null
  }

  def f(x: X) = ???
  def g(y: Y) = ???
}

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
    """
  }
}