Ensure that UElement.nameIdentifier.containingFile is a real file
This is needed to report inspection problems on UAST elements.
This commit is contained in:
@@ -40,4 +40,17 @@ class KotlinUastApiTest : AbstractKotlinUastTest() {
|
||||
assertNull(uLiteral)
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun testNameContainingFile() {
|
||||
doTest("NameContainingFile") { _, file ->
|
||||
val foo = file.findElementByText<UClass>("class Foo")
|
||||
assertEquals(file.psi, foo.nameIdentifier!!.containingFile)
|
||||
|
||||
val bar = file.findElementByText<UMethod>("fun bar() {}")
|
||||
assertEquals(file.psi, bar.nameIdentifier!!.containingFile)
|
||||
|
||||
val xyzzy = file.findElementByText<UVariable>("val xyzzy: Int = 0")
|
||||
assertEquals(file.psi, xyzzy.nameIdentifier!!.containingFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user