summaryrefslogblamecommitdiff
path: root/test/files/run/toolbox_typecheck_implicitsdisabled.scala
blob: 95a7056279f9c3563a044549b492b379a0ef149e (plain) (tree)
1
2
3
4
5
6
7
8
9



                                                  

                         
                              
 
                         

                                                                                                                    




                                                                          
                           

                                                                                                                      







                                                                           
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox

object Test extends App {
  val toolbox = cm.mkToolBox()

  val tree1 = Block(List(
    Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
    Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
  )
  val ttree1 = toolbox.typeCheck(tree1, withImplicitViewsDisabled = false)
  println(ttree1)

  try {
    val tree2 = Block(List(
      Import(Select(Ident(TermName("scala")), TermName("Predef")), List(ImportSelector(nme.WILDCARD, -1, null, -1)))),
      Apply(Select(Literal(Constant(1)), TermName("$minus$greater")), List(Literal(Constant(2))))
    )
    val ttree2 = toolbox.typeCheck(tree2, withImplicitViewsDisabled = true)
    println(ttree2)
  } catch {
    case ex: Throwable =>
      println(ex)
  }
}