aboutsummaryrefslogblamecommitdiff
path: root/compiler/test/dotty/tools/dotc/ast/TreeInfoTest.scala
blob: a55973c43db48aba7862189c6eba423f99fbf700 (plain) (tree)
1
2
3
4
5

                   


                     
























                                                                                                   
package dotty.tools
package dotc
package ast

import org.junit.Test
import core.Names._
import core.Types._
import core.Symbols._
import org.junit.Assert._

class TreeInfoTest extends DottyTest {

  import tpd._

  @Test
  def testDefPath = checkCompile("frontend", "class A { def bar = { val x = { val z = 0; 0} }} ") {
    (tree, context) =>
      implicit val ctx = context
      val xTree = tree.find(tree => tree.symbol.name == termName("x")).get
      val path = defPath(xTree.symbol, tree)
      assertEquals(List(
        ("PackageDef", EMPTY_PACKAGE),
        ("TypeDef", typeName("A")),
        ("Template", termName("<local A>")),
        ("DefDef", termName("bar")),
        ("Block", NoSymbol.name),
        ("ValDef", termName("x"))
      ), path.map(x => (x.productPrefix, x.symbol.name)))
  }
}