Support line location information in KAPT for top level declarations

This CL fixes a bug in KAPT's MAP_DIAGNOSTIC_LOCATIONS flag where the
location mapping for top level elements didn't work.

I also needed to changes the Kapt3IntegrationTest to copy input files,
otherwise, it cannot map file paths since the mock project has no root
location.

Cleanup tmp folders in KAPT tests, update Kapt3IT test for new lines.

^KT-47934 Fixed
Test: KotlinKapt3IntegrationTests#testErrorLocationMapping
This commit is contained in:
Yigit Boyar
2021-07-30 17:05:28 -07:00
committed by Yahor Berdnikau
parent ec3a6e7f02
commit 95f990adab
11 changed files with 209 additions and 6 deletions
@@ -479,9 +479,9 @@ open class Kapt3IT : Kapt3BaseIT() {
val actual = getErrorMessages()
// try as 0 starting lines first, then as 1 starting line
try {
Assert.assertEquals(genKotlinErrorString(2, 6), actual)
Assert.assertEquals(genKotlinErrorString(3, 6), actual)
} catch (e: AssertionError) {
Assert.assertEquals(genKotlinErrorString(3, 7), actual)
Assert.assertEquals(genKotlinErrorString(4, 7), actual)
}
}
}