FIR: fix libs filtering for abs/rel paths combinations

Some of the incoming paths "absoluteness" may not match the
one of the corresponding library path, and that leaded to incorrect
filtering out some items in the deserialized symbol providers.
Fix the filtering to account for the mismatch.
#KT-57535 fixed
This commit is contained in:
Ilya Chernikov
2023-04-12 14:51:24 +02:00
committed by Space Team
parent 030866cb0b
commit df35e5431c
2 changed files with 27 additions and 1 deletions
@@ -57,7 +57,15 @@ abstract class LibraryPathFilter {
override fun accepts(path: Path?): Boolean {
if (path == null) return false
return libs.any { path.startsWith(it) }
val isPathAbsolute = path.isAbsolute
val absolutePath by lazy(LazyThreadSafetyMode.NONE) { path.toAbsolutePath() }
return libs.any {
when {
it.isAbsolute && !isPathAbsolute -> absolutePath.startsWith(it)
!it.isAbsolute && isPathAbsolute -> path.startsWith(it.toAbsolutePath())
else -> path.startsWith(it)
}
}
}
}
}