From 42abaaa0994ee5d0cc900e1f819605b88185f64f Mon Sep 17 00:00:00 2001 From: Jonas Herzig Date: Thu, 11 Nov 2021 20:35:57 +0100 Subject: Fix `valid(PsiElement)` method We seem to no longer be relying on it too much. There are still a few issues which have gone unnoticed due to this bug but those will be fixed in the following commits. --- src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt index f7b50ba..7e8162f 100644 --- a/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt +++ b/src/main/kotlin/com/replaymod/gradle/remap/PsiMapper.kt @@ -55,14 +55,7 @@ internal class PsiMapper( } } - private fun valid(e: PsiElement): Boolean { - val range = e.textRange - // FIXME This implementation is technically wrong but some parts of the - // remapper now rely on that, so fixing it is non-trivial. - // For a proper implementation see the TextRange version below. - val before = changes.ceilingKey(range) - return before == null || !before.intersects(range) - } + private fun valid(e: PsiElement): Boolean = valid(e.textRange) private fun valid(range: TextRange): Boolean { val before = changes.floorKey(range) ?: TextRange.EMPTY_RANGE -- cgit