[FE] Don't analyze members with CLASSIFIERS kind filter in AbstractLazyMemberScope
This commit introduces partial support of descriptorKindFilter in
`AbstractPsiBasedDeclarationProvider`. Without it there may be an error
in following case:
```
sealed class Base
class Derived : Base()
class Test<out V>(val x: Base) {
private val y = when (x) {
is Derived -> null
}
}
```
Here we start to resolve type of `y`, then go to computation of inheritors
of sealed class Base, which also may be inside Test, so we need get all
nested classifiers in Test. But without this filtration we will start
computing descriptor for `y` again, which leads to ReenteringLazyComputationException
#KT-44316 Fixed
This commit is contained in:
@@ -138,6 +138,24 @@ class DescriptorKindFilter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as DescriptorKindFilter
|
||||
|
||||
if (excludes != other.excludes) return false
|
||||
if (kindMask != other.kindMask) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = excludes.hashCode()
|
||||
result = 31 * result + kindMask
|
||||
return result
|
||||
}
|
||||
|
||||
companion object {
|
||||
private var nextMaskValue: Int = 0x01
|
||||
private fun nextMask() = nextMaskValue.apply { nextMaskValue = nextMaskValue shl 1 }
|
||||
|
||||
Reference in New Issue
Block a user