From 770c280ba5de7158da44ea1e77b6ea5ca6614ea0 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Tue, 10 Jul 2018 17:39:07 +0200 Subject: [PATCH] Light classes: handle broken context in case of supertype delegation This lead to an exception being thrown frequently Proper fix would be to prevent binding context from being corrupted Known cases are hard to debug/reproduce #EA-101081 Fixed --- .../src/org/jetbrains/kotlin/backend/common/CodegenUtil.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.kt b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.kt index 9cb95405fe6..fc5f15fb642 100644 --- a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.kt +++ b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.kt @@ -98,9 +98,8 @@ object CodegenUtil { @JvmStatic fun getSuperClassBySuperTypeListEntry(specifier: KtSuperTypeListEntry, bindingContext: BindingContext): ClassDescriptor? { val superType = bindingContext.get(BindingContext.TYPE, specifier.typeReference!!) - ?: error("superType should not be null: ${specifier.text}") - return superType.constructor.declarationDescriptor as? ClassDescriptor + return superType?.constructor?.declarationDescriptor as? ClassDescriptor } @JvmStatic