Fix parent and containingFile for throws-reference list

Otherwise, exception is thrown during type inference
because default implementations effectively return null

^KT-29287 Fixed
This commit is contained in:
Denis Zharkov
2019-02-06 11:43:36 +03:00
parent f040eaff27
commit 1a630773cf
7 changed files with 38 additions and 1 deletions
@@ -56,7 +56,11 @@ internal abstract class KtUltraLightMethod(
abstract override fun buildTypeParameterList(): PsiTypeParameterList
private val _throwsList: PsiReferenceList by lazyPub {
val list = KotlinLightReferenceListBuilder(manager, language, PsiReferenceList.Role.THROWS_LIST)
val list =
object : KotlinLightReferenceListBuilder(manager, language, PsiReferenceList.Role.THROWS_LIST) {
override fun getParent() = this@KtUltraLightMethod
override fun getContainingFile() = this@KtUltraLightMethod.containingFile
}
computeDescriptor()?.let {
for (ex in FunctionCodegen.getThrownExceptions(it)) {
val psiClassType = ex.defaultType.asPsiType(support, TypeMappingMode.DEFAULT, list) as? PsiClassType ?: continue