[groovy] TypeLattice: fix fallbacks for join() and meet()

GitOrigin-RevId: 7395f5828b5faac9d6f40d0a6e99a9ed2100454d
This commit is contained in:
Bartek Pacia
2025-09-04 18:38:28 +00:00
committed by intellij-monorepo-bot
parent f9c0d46abd
commit 0d3e33acfd
@@ -168,14 +168,14 @@ private fun PsiType.mapConjuncts(action: (PsiType) -> PsiType): PsiType {
private class TypeLattice(context: PsiElement) {
private val manager = context.manager
private val top = getJavaLangObject(context) as PsiType
private val bottom = PsiTypes.nullType() as PsiType
private val bottom = PsiTypes.nullType()
fun join(types: Iterable<PsiType>): PsiType = types.fold(bottom) { accum, type ->
GenericsUtil.getLeastUpperBound(accum, type, manager) ?: bottom
GenericsUtil.getLeastUpperBound(accum, type, manager) ?: top
}
fun meet(types: Iterable<PsiType>): PsiType = types.fold(top) { accum, type ->
GenericsUtil.getGreatestLowerBound(accum, type)
GenericsUtil.getGreatestLowerBound(accum, type) ?: bottom
}
}